forked from unimatrix/web
20 lines
1.9 KiB
PHP
20 lines
1.9 KiB
PHP
<?php
|
|
define('IN_MYBB',1);
|
|
require __DIR__.'/system-board-provision.php';
|
|
$grant=['kind'=>'clan','id'=>'11111111-1111-4111-8111-111111111111','name'=>'Fixture Clan','read'=>true,'post'=>true];
|
|
$projection=['version'=>1,'organisations'=>[$grant,$grant,array_merge($grant,['kind'=>'unknown']),array_merge($grant,['read'=>false])]];
|
|
$missing=dune_missing_system_boards($projection,[]);
|
|
if(count($missing)!==1 || $missing[0]['name']!=='Fixture Clan')throw new RuntimeException('Missing verified clan must be deduplicated and provisioned');
|
|
if(dune_missing_system_boards($projection,['clan:'.$grant['id']=>['fid'=>10]])!==[])throw new RuntimeException('Existing board must not be recreated');
|
|
foreach([array_merge($grant,['id'=>'injected']),array_merge($grant,['name'=>''])] as $invalid){
|
|
$rejected=false;try{dune_missing_system_boards(['version'=>1,'organisations'=>[$invalid]],[]);}catch(RuntimeException $e){$rejected=true;}
|
|
if(!$rejected)throw new RuntimeException('Invalid verified identity must fail closed');
|
|
}
|
|
$boards=array_map(fn($fid)=>['fid'=>$fid],range(1,10));$groups=array_fill_keys(range(1,20),[]);
|
|
$pairs=iterator_to_array(dune_board_permission_targets($boards,$groups,[1=>true],[]),false);
|
|
if(count($pairs)!==20)throw new RuntimeException('A rename must refresh one board, not every board');
|
|
$pairs=iterator_to_array(dune_board_permission_targets($boards,$groups,[1=>true],[19=>true,20=>true]),false);
|
|
if(count($pairs)!==38)throw new RuntimeException('New managed groups must be denied on every unrelated board');
|
|
$seen=[];foreach($pairs as [$board,$gid]){$identity=$board['fid'].':'.$gid;if(isset($seen[$identity]))throw new RuntimeException('Permission pair processed twice');$seen[$identity]=true;}
|
|
foreach(range(2,10)as $fid)foreach([19,20]as $gid)if(!isset($seen[$fid.':'.$gid]))throw new RuntimeException('Cross-board new-group denial missing');
|
|
echo "System Boards provisioning policy and bounded permission-matrix checks passed\n";
|

Staff