Auth: reduce allocs (#55410)

This commit is contained in:
Jo 2022-09-20 12:03:08 +02:00 committed by GitHub
parent 10b3c0787a
commit 13146cc812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,8 +173,8 @@ func BuildPermissionsMap(permissions []Permission) map[string]bool {
// GroupScopesByAction will group scopes on action
func GroupScopesByAction(permissions []Permission) map[string][]string {
m := make(map[string][]string)
for _, p := range permissions {
m[p.Action] = append(m[p.Action], p.Scope)
for i := range permissions {
m[permissions[i].Action] = append(m[permissions[i].Action], permissions[i].Scope)
}
return m
}