Files
SGF/scripts/sgf-payable-due-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=['supplier_payables.due.prepare','supplier_payables.due.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','supplier_payables.view')->whereIn('user_id',[13,14,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'),'original_due_dates'=>$native->table('pa_obligations')->orderBy('id')->get(['id','due_on'])->all()];
file_put_contents($work.'/payable-due-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.'/payable-due-access-readonly.json']).PHP_EOL;