Files
SGF/scripts/sgf-remunerations-access-readonly.php
2026-11-11 09:00:17 +02:00

7 lines
1.2 KiB
PHP

<?php
$book=$argv[1]??'8085';require __DIR__.'/sgf-single-bootstrap.php';
$rights=['remunerations.view','remunerations.prepare','remunerations.review'];
$host->beginTransaction();$host->statement('SET TRANSACTION READ ONLY');
try{$grants=$host->table('permission_grants')->where(['tenant_id'=>1,'company_id'=>2,'unit_id'=>2])->whereIn('permission',$rights)->get(['user_id','permission'])->all();$profiles=$host->table('users')->whereIn('id',[13,14,15,16,17])->orderBy('id')->pluck('id')->all();if(count($profiles)!==5)throw new LogicException('Expected existing QA profiles missing');if(count($grants)!==0)throw new LogicException('Reconcile existing rights before proposal');$out=['passed'=>true,'book'=>$book,'proposed_rights'=>$rights,'existing_proposed_grants'=>$grants,'existing_profile_ids'=>$profiles,'new_grants'=>0,'business_writes'=>0,'native_journals'=>$native->table('gl_journals')->count()];}finally{$host->rollBack();}
file_put_contents($work.'/remunerations-access-readonly.json',json_encode($out,JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'book'=>$book,'existing_proposed_grants'=>$grants,'proof'=>$work.'/remunerations-access-readonly.json']).PHP_EOL;