Allow the current Dev account to edit and close approved requests
This commit is contained in:
parent
2c7a7b3169
commit
c2a822249f
2 changed files with 10 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ function dune_dev_transition($identity,$action,$state,$note) {
|
|||
if($action==='deny'&&$state==='pending')return 'denied';
|
||||
throw new RuntimeException('This action is not available for the current task state.');
|
||||
}
|
||||
function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&in_array('web_dev',$identity['ranks']??[],true));}
|
||||
function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&dune_dev_team($identity));}
|
||||
function dune_dev_legacy_fields() {
|
||||
return [
|
||||
'title'=>['Task title',true,160,'input','A short, specific outcome'],
|
||||
|
|
|
|||
|
|
@ -27,4 +27,13 @@ $bad=valid_request();$bad['execution_state']='completed';[$v,$e]=dune_dev_valida
|
|||
check(str_contains(dune_dev_execution_brief(['objective'=>'Old request']),'Legacy request'),'Legacy ticket was reinterpreted as an executable instruction');
|
||||
$original=['title'=>'Old title','objective'=>'Original request'];$copy=$original;dune_dev_execution_brief($original);check($original===$copy,'Legacy request data mutated');
|
||||
$owner=['username'=>'unimatrix999','ranks'=>['owners']];check(dune_dev_owner($owner),'Existing owner approval changed');check(!dune_dev_owner(['username'=>'unimatrix999','ranks'=>['user']]),'Name alone gained owner authority');
|
||||
$dev=['username'=>'dev','ranks'=>['network_admin']];
|
||||
check(dune_dev_team($dev)&&dune_dev_submitter($dev)&&dune_dev_priority_editor($dev),'Current Dev account cannot read/write Dev requests');
|
||||
check(dune_dev_transition($dev,'complete','approved','Verified completion evidence attached.')==='completed','Dev cannot close approved work');
|
||||
check(!dune_dev_owner($dev),'Dev gained owner approval authority');
|
||||
check(!dune_dev_priority_editor(['username'=>'dev','ranks'=>['user']]),'Dev name alone grants editing');
|
||||
check(!dune_dev_priority_editor(['username'=>'other','ranks'=>['network_admin']]),'Unrelated account gained Dev editing');
|
||||
$managed=['username'=>'dev','nativePermissionManagement'=>false,'permissions'=>['web.tickets.dev'],'ranks'=>['user']];
|
||||
check(dune_dev_priority_editor($managed),'Managed Dev permission was ignored');
|
||||
$managed['permissions']=[];check(!dune_dev_priority_editor($managed),'Removed Dev permission still allows editing');
|
||||
echo json_encode(['passed'=>$checks,'failed'=>0,'ticket_created'=>false,'keys_issued'=>0])."\n";
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff