RBAC: fix wildcard check (#61666)

RBAC: break correct loop
This commit is contained in:
Karl Persson 2023-01-18 13:19:09 +01:00 committed by GitHub
parent 9256ca371d
commit db0be6bc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,16 +203,20 @@ func (f AccessControlDashboardPermissionFilter) Where() (string, []interface{})
func actionsToCheck(actions []string, permissions map[string][]string, wildcards ...accesscontrol.Wildcards) []interface{} {
toCheck := make([]interface{}, 0, len(actions))
for _, a := range actions {
var hasWildcard bool
outer:
for _, scope := range permissions[a] {
for _, w := range wildcards {
if w.Contains(scope) {
hasWildcard = true
break
break outer
}
}
}
if !hasWildcard {
toCheck = append(toCheck, a)
}