RBAC: Display indicator if a permission is inherited (#54080) (#54380)

* RBAC: Add IsInherited property

* PermissionList: Display inherited indicator

(cherry picked from commit cc78486535)

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-08-29 05:29:37 -04:00
committed by GitHub
co-authored by Karl Persson
parent c8a313c289
commit 493c7866a2
6 changed files with 9 additions and 2 deletions
@@ -34,7 +34,7 @@ func (p *flatResourcePermission) IsManaged(scope string) bool {
}
func (p *flatResourcePermission) IsInherited(scope string) bool {
return p.Scope != scope
return !strings.HasPrefix(p.Scope, strings.Split(strings.ReplaceAll(scope, "*", ""), ":")[0])
}
func (s *AccessControlStore) SetUserResourcePermission(
@@ -472,6 +472,7 @@ func flatPermissionsToResourcePermission(scope string, permissions []flatResourc
Created: first.Created,
Updated: first.Updated,
IsManaged: first.IsManaged(scope),
IsInherited: first.IsInherited(scope),
}
}