$board) { $fid=(int)$board['fid']; foreach (['1','2'] as $groups) { $permission=forum_permissions($fid,0,$groups); if (!empty($permission['canview']) || !empty($permission['cansearch']) || !empty($permission['candlattachments'])) throw new RuntimeException('Nonmember access: '.$key); $count++; } foreach ($boards as $otherKey=>$other) foreach (['member_gid','leader_gid'] as $field) { $permission=forum_permissions($fid,0,'2,'.(int)$other[$field]); $expected=$key===$otherKey; if (!empty($permission['canview'])!==$expected || !empty($permission['canpostthreads'])!==$expected || !empty($permission['candlattachments'])!==$expected) throw new RuntimeException('Organisation boundary failed: '.$key.' / '.$otherKey); $count++; } foreach (['3','4','6'] as $groups) { $permission=forum_permissions($fid,0,$groups); if (empty($permission['canview'])) throw new RuntimeException('Existing staff lost access: '.$key); $count++; } } echo json_encode(['status'=>'passed','checks'=>$count,'organisations'=>count($boards),'writes'=>0],JSON_THROW_ON_ERROR)."\n";