Zanzana: Evaluate permissions alongside with RBAC engine (#90064)
* Zanzana: Evaluate permissions if feature flag enabled * Fix tests * adjust logs * fix spelling * remove unused * only evaluate implemented resources * refactor
This commit is contained in:
@@ -214,19 +214,7 @@ func (p Permission) OSSPermission() Permission {
|
||||
|
||||
// SplitScope returns kind, attribute and Identifier
|
||||
func (p Permission) SplitScope() (string, string, string) {
|
||||
if p.Scope == "" {
|
||||
return "", "", ""
|
||||
}
|
||||
|
||||
fragments := strings.Split(p.Scope, ":")
|
||||
switch l := len(fragments); l {
|
||||
case 1: // Splitting a wildcard scope "*" -> kind: "*"; attribute: "*"; identifier: "*"
|
||||
return fragments[0], fragments[0], fragments[0]
|
||||
case 2: // Splitting a wildcard scope with specified kind "dashboards:*" -> kind: "dashboards"; attribute: "*"; identifier: "*"
|
||||
return fragments[0], fragments[1], fragments[1]
|
||||
default: // Splitting a scope with all fields specified "dashboards:uid:my_dash" -> kind: "dashboards"; attribute: "uid"; identifier: "my_dash"
|
||||
return fragments[0], fragments[1], strings.Join(fragments[2:], ":")
|
||||
}
|
||||
return SplitScope(p.Scope)
|
||||
}
|
||||
|
||||
type GetUserPermissionsQuery struct {
|
||||
|
||||
Reference in New Issue
Block a user