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','general_ledger.view')->whereIn('user_id',[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/general-ledger/src/LedgerReports.php'),'native_journals'=>$native->table('gl_journals')->count()]; file_put_contents($work.'/statements-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.'/statements-access-readonly.json']).PHP_EOL;