Skip to content

Commit 3dab7c1

Browse files
committed
fix(policy): decouple resolver editability from overrides
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent d5e8a49 commit 3dab7c1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/Service/Policy/Runtime/DefaultPolicyResolver.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private function resolveCore(
119119
->setEffectiveValue($currentValue)
120120
->setSourceScope($currentSourceScope)
121121
->setVisible($visible)
122-
->setEditableByCurrentActor($visible && $canOverrideBelow)
122+
->setEditableByCurrentActor($visible && $this->canManagePolicyAtCurrentScope($context))
123123
->setCanSaveAsUserDefault($visible && $canOverrideBelow)
124124
->setCanUseAsRequestOverride($visible && $canOverrideBelow)
125125
->setBlockedBy($currentBlockedBy);
@@ -258,6 +258,13 @@ private function canApplyLowerLayer(
258258
return true;
259259
}
260260

261+
private function canManagePolicyAtCurrentScope(PolicyContext $context): bool {
262+
$actorCapabilities = $context->getActorCapabilities();
263+
264+
return ($actorCapabilities['canManageSystemPolicies'] ?? false) === true
265+
|| ($actorCapabilities['canManageGroupPolicies'] ?? false) === true;
266+
}
267+
261268
/** @param list<mixed> $currentAllowedValues
262269
* @param list<mixed> $layerAllowedValues
263270
* @return list<mixed>

0 commit comments

Comments
 (0)