Files
SGF/scripts/sgf-assets-access-readonly.php
T
2026-11-11 15:04:01 +02:00

3 lines
992 B
PHP

<?php
$book=$argv[1]??'8085';require __DIR__.'/sgf-single-bootstrap.php';$rights=['fixed_assets.view','fixed_assets.prepare','fixed_assets.review'];$rows=$host->table('permission_grants')->whereIn('permission',$rights)->get(['permission','user_id','tenant_id','company_id','unit_id'])->all();if($rows!==[])throw new LogicException('Reconcile existing asset rights');$old=$host->table('permission_grants')->where(['tenant_id'=>1,'company_id'=>2,'unit_id'=>2])->whereIn('user_id',[15,16,17])->where('permission','like','general_ledger.%')->orderBy('user_id')->orderBy('permission')->get(['user_id','permission'])->all();file_put_contents($work.'/assets-access-readonly.json',json_encode(['passed'=>true,'book'=>$book,'proposed_rights'=>$rights,'existing_asset_grants'=>$rows,'existing_ledger_grants'=>$old,'new_grants'=>0,'database_writes'=>0],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'book'=>$book,'missing_asset_rights'=>3,'proof'=>$work.'/assets-access-readonly.json']).PHP_EOL;