3 lines
1.4 KiB
PHP
3 lines
1.4 KiB
PHP
<?php
|
|
$book=$argv[1]??'8085';require __DIR__.'/sgf-single-bootstrap.php';$rights=['services.view','services.create','service_drafts.view','service_drafts.create','service_drafts.edit','billing_drafts.view','billing_drafts.create','billing_drafts.edit','issuer_documents.view','client_documents.view','draft_documents.view','draft_documents.edit','invoice_series.propose','invoice_series.approve','service_fiscal.propose','service_fiscal.approve','service_invoices.view','service_invoices.issue','general_ledger.view','general_ledger.prepare','general_ledger.validate','general_ledger.post'];$rows=$host->table('permission_grants')->where(['tenant_id'=>1,'company_id'=>2])->where(fn($q)=>$q->whereNull('unit_id')->orWhere('unit_id',2))->whereIn('permission',$rights)->orderBy('user_id')->orderBy('permission')->get(['user_id','permission','unit_id'])->map(fn($r)=>(array)$r)->all();$missing=array_values(array_diff($rights,array_column($rows,'permission')));if($missing)throw new LogicException('Additional powers need explicit proposal '.implode(',',$missing));file_put_contents($work.'/multiline-invoice-existing-access-private.json',json_encode(['passed'=>true,'book'=>$book,'existing_grants'=>$rows,'required_names'=>$rights,'missing'=>[],'database_writes'=>0,'new_grants'=>0],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'book'=>$book,'existing_permission_names'=>count($rights),'new_grants'=>0,'proof'=>$work.'/multiline-invoice-existing-access-private.json']).PHP_EOL;
|