Files
SGF/scripts/sgf-hr-personnel-finalize.php
2026-11-11 15:04:01 +02:00

3 lines
1.3 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$file='docs/integration/sgf-human-resources-personnel-access-proposal.json';$old=json_decode(file_get_contents($s['app'].'/'.$file),true);$new=json_decode(file_get_contents($repo.'/'.$file),true);$hash=fn($p)=>hash('sha256',Tempo\Finance\Payables\Payables::canonical(['scope'=>$p['scope'],'grants'=>$p['grants_per_book']]));if($hash($old)!==$hash($new))throw new LogicException('Do not change reviewed grants at finalization');copy($s['app'].'/'.$file,$work.'/access-policy-before-private.json');copy($repo.'/'.$file,$s['app'].'/'.$file);$installation=json_decode(file_get_contents($s['root'].'/single-integration/20261111-090956-998c70ef/hp-installation.json'),true);foreach($installation['hashes']as$path=>$sha){if($path===$file)$sha=hash_file('sha256',$repo.'/'.$file);if(hash_file('sha256',$s['app'].'/'.$path)!==$sha)throw new LogicException('Installed source changed '.$path);}file_put_contents($work.'/hp-finalization.json',json_encode(['passed'=>true,'installed_files_verified'=>count($installation['hashes']),'access_pin_unchanged'=>true,'metadata_status_updated'=>true,'new_grants'=>0,'business_commands'=>0,'cache_cleared'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/hp-finalization.json']).PHP_EOL;