forked from unimatrix/web
30 lines
1.7 KiB
PHP
30 lines
1.7 KiB
PHP
<?php
|
|
// Read-only checks against actual MyBB inheritance after provisioning.
|
|
if (PHP_SAPI !== 'cli') exit(1);
|
|
$_SERVER['SCRIPT_NAME']='/dune-sso.php'; $_SERVER['REQUEST_METHOD']='GET';
|
|
$_SERVER['REMOTE_ADDR']='127.0.0.1'; $_SERVER['HTTP_HOST']='forums.dunerealms.com';
|
|
define('IN_MYBB',1); chdir('/home/dunerealms/apps/integrations/mybb');
|
|
ob_start(); require 'global.php'; ob_end_clean();
|
|
require_once __DIR__.'/system-board-membership.php';
|
|
$boards=dune_system_board_registry(); $count=0;
|
|
if (!$boards) throw new RuntimeException('No organisation boards were provisioned');
|
|
foreach ($boards as $key=>$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";
|

Staff