From eb4c8e1b1e24facf0cb57ed24f8b06315549fc0d Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 20 Feb 2023 01:27:44 -0800 Subject: [PATCH] Fix inherited permissions being set at user level & unable to unselect existing perms --- .../permissions-select/permissions-select.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts b/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts index 74e8a73c4..fa97a3b55 100644 --- a/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts +++ b/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts @@ -69,6 +69,10 @@ export class PermissionsSelectComponent } writeValue(permissions: string[]): void { + if (this.permissions === permissions) { + return + } + this.permissions = permissions ?? [] const allPerms = this._inheritedPermissions.concat(this.permissions) @@ -138,7 +142,10 @@ export class PermissionsSelectComponent this.typesWithAllActions.delete(typeKey) } }) - this.onChange(permissions) + + this.onChange( + permissions.filter((p) => !this._inheritedPermissions.includes(p)) + ) }) }