break the pointless loop when group matched

Signed-off-by: guoyao <1015105054@qq.com>
This commit is contained in:
guoyao 2021-10-11 11:11:30 +08:00
parent 0e260a027b
commit a49af6cd1c

View File

@ -164,6 +164,7 @@ func subjectMatches(p abac.Policy, user user.Info) bool {
for _, group := range groups { for _, group := range groups {
if p.Spec.Group == group { if p.Spec.Group == group {
matched = true matched = true
break
} }
} }
if !matched { if !matched {