From f8b77d7ef799f0975fa9bc98e70a03ffb3d2840c Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 12 Dec 2022 15:43:27 -0800 Subject: [PATCH] fix inherited permissions not visually showing as checked --- .../user-edit-dialog/user-edit-dialog.component.html | 2 +- .../permissions-select/permissions-select.component.html | 2 +- .../permissions-select/permissions-select.component.ts | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.html index 5bb5b5d81..1b811d5f7 100644 --- a/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.html +++ b/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.html @@ -18,7 +18,7 @@
- +
diff --git a/src-ui/src/app/components/common/permissions-select/permissions-select.component.html b/src-ui/src/app/components/common/permissions-select/permissions-select.component.html index 9f089449a..1907f4e3f 100644 --- a/src-ui/src/app/components/common/permissions-select/permissions-select.component.html +++ b/src-ui/src/app/components/common/permissions-select/permissions-select.component.html @@ -13,7 +13,7 @@
{{type.key}}:
- +
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 0a0c86ec4..74e8a73c4 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 @@ -46,9 +46,14 @@ export class PermissionsSelectComponent @Input() set inheritedPermissions(inherited: string[]) { // remove . from permission strings - this._inheritedPermissions = inherited?.length + const newInheritedPermissions = inherited?.length ? inherited.map((p) => p.replace(/^\w+\./g, '')) : [] + + if (this._inheritedPermissions !== newInheritedPermissions) { + this._inheritedPermissions = newInheritedPermissions + this.writeValue(this.permissions) // updates visual checks etc. + } } inheritedWarning: string = $localize`Inerhited from group`