Skip to content

Commit e032323

Browse files
committed
fix(policy): allow instance-admin override for target user policy save
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b7dd3ff commit e032323

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/Service/Policy/PolicyService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function saveUserPreferenceForUserId(string|\BackedEnum $policyKey, strin
130130
$context = $this->contextFactory->forUserId($userId);
131131
$definition = $this->registry->get($policyKey);
132132
$resolved = $this->resolver->resolve($definition, $context);
133-
if (!$resolved->canSaveAsUserDefault()) {
133+
if (!$resolved->canSaveAsUserDefault() && !$this->contextFactory->isCurrentActorSystemAdmin()) {
134134
throw new \InvalidArgumentException('Saving a user preference is not allowed for ' . $definition->key());
135135
}
136136

0 commit comments

Comments
 (0)