From: Bill Erickson Date: Thu, 7 Jul 2022 16:29:22 +0000 (-0400) Subject: LP1891375 Perm Group Editor Indicates Overridden Perms X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=620925f0df3dd4b2eaabed57fbfb76222c0edf17;p=Evergreen.git LP1891375 Perm Group Editor Indicates Overridden Perms When a permission for the selected group overrides the same permission applied to a parent group, indicate it in the permission list with an icon. Signed-off-by: Bill Erickson Signed-off-by: Terran McCanna Signed-off-by: Michele Morgan --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html index d906400232..8fd734912a 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.html @@ -136,6 +136,15 @@ Clear + +
+ + Permissions marked with a + new_releases + override parent group permissions. + +
Permissions
@@ -148,9 +157,14 @@
- - {{map.perm().code()}} + + + {{map.perm().code()}} + + new_releases
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts index c6fd1310e6..5c8b083eae 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/perm-group-tree.component.ts @@ -83,6 +83,7 @@ export class PermGroupTreeComponent implements OnInit { this.orgDepths = depths2.sort(); } + // Returns maps for this group and ancestors groupPermMaps(): IdlObject[] { if (!this.selected) { return []; } @@ -204,6 +205,25 @@ export class PermGroupTreeComponent implements OnInit { return m.grp().id() !== this.selected.callerData.id(); } + // True if the provided mapping applies to the selected group + // and a mapping for the same permission exists for an ancestor. + permOverrides(m: IdlObject): boolean { + const grpId = this.selected.callerData.id(); + + if (m.grp().id() === grpId) { // Selected group has the perm. + + // See if at least one of our ancestors also has the perm. + return this.groupPermMaps().filter(mp => { + return ( + mp.perm().id() === m.perm().id() && + mp.grp().id() !== grpId + ); + }).length > 0; + } + + return false; + } + // List of perm maps that owned by perm groups which are ancestors // of the selected group inheritedPermissions(): IdlObject[] {