Simplify check of principals in a case insensitive way

Fixes #679
This commit is contained in:
Mariano Cano 2021-09-08 16:00:33 -07:00
parent 7a94b0c157
commit 141c519171

View file

@ -454,20 +454,12 @@ func containsAllMembers(group, subgroup []string) bool {
if lsg > lg || (lg > 0 && lsg == 0) {
return false
}
groupLower := []string{}
subgroupLower := []string{}
for _, s := range group {
groupLower = append(groupLower, strings.ToLower(s))
}
for _, s := range subgroup {
subgroupLower = append(subgroupLower, strings.ToLower(s))
}
visit := make(map[string]struct{}, lg)
for i := 0; i < lg; i++ {
visit[groupLower[i]] = struct{}{}
visit[strings.ToLower(group[i])] = struct{}{}
}
for i := 0; i < lsg; i++ {
if _, ok := visit[subgroupLower[i]]; !ok {
if _, ok := visit[strings.ToLower(subgroup[i])]; !ok {
return false
}
}