Skip to content

Commit 76a9f6e

Browse files
committed
feat: map assigned user policies in workbench
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 9b99a76 commit 76a9f6e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/views/Settings/PolicyWorkbench/useRealPolicyWorkbench.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export function createRealPolicyWorkbenchState() {
227227
}
228228

229229
const sourceScope = policy.sourceScope
230-
if (sourceScope === 'group' || sourceScope === 'user') {
230+
if (sourceScope === 'group' || sourceScope === 'user' || sourceScope === 'user_policy') {
231231
return explicitSystemRule.value
232232
}
233233

@@ -311,6 +311,10 @@ export function createRealPolicyWorkbenchState() {
311311
return sourceScope
312312
}
313313

314+
if (sourceScope === 'user_policy') {
315+
return 'user'
316+
}
317+
314318
return hasGlobalDefault.value ? 'global' : 'system'
315319
})
316320

@@ -523,7 +527,7 @@ export function createRealPolicyWorkbenchState() {
523527
id: `user-${user.id}-persisted`,
524528
scope: 'user' as const,
525529
targetId: user.id,
526-
allowChildOverride: true,
530+
allowChildOverride: persistedPolicy.allowChildOverride,
527531
value: persistedPolicy.value,
528532
}
529533
} catch (error) {
@@ -879,11 +883,11 @@ export function createRealPolicyWorkbenchState() {
879883
}
880884

881885
await Promise.all(targetIds.map((targetId) => {
882-
return policiesStore.saveUserPolicyForUser(targetId, policyKey, value)
886+
return policiesStore.saveUserPolicyForUser(targetId, policyKey, value, allowChildOverride)
883887
}))
884888

885889
for (const targetId of targetIds) {
886-
upsertRule(userRules.value, 'user', targetId, value, true)
890+
upsertRule(userRules.value, 'user', targetId, value, allowChildOverride)
887891
}
888892

889893
await policiesStore.fetchEffectivePolicies()

0 commit comments

Comments
 (0)