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

8 lines
1.1 KiB
PHP

<?php
$book=$argv[1]??'8085';require __DIR__.'/sgf-single-bootstrap.php';
$rights=['fiscal_obligations.view','fiscal_obligations.prepare','fiscal_obligations.review'];
$grants=$host->table('permission_grants')->where(['tenant_id'=>1,'company_id'=>2,'unit_id'=>2])->whereIn('permission',$rights)->get(['user_id','permission'])->all();
$existing=$host->table('permission_grants')->where(['tenant_id'=>1,'company_id'=>2,'unit_id'=>2])->where('permission','fiscal_forms.view')->whereIn('user_id',[13,14,15,16,17])->orderBy('user_id')->get(['user_id','permission'])->all();
$out=['passed'=>true,'book'=>$book,'proposed_rights'=>$rights,'existing_proposed_grants'=>$grants,'existing_read_grants'=>$existing,'new_grants'=>0,'business_writes'=>0,'source_sha256'=>hash_file('sha256',$repo.'/packages/payables/src/Payables.php'),'fiscal_versions'=>$host->table('fx_versions')->count()];
file_put_contents($work.'/fiscal-obligations-access-readonly.json',json_encode($out,JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'book'=>$book,'existing_proposed_grants'=>$grants,'existing_read_grants'=>$existing,'proof'=>$work.'/fiscal-obligations-access-readonly.json']).PHP_EOL;