fix: empty matched policies list for roles

This commit is contained in:
Qiu Jian
2020-05-22 18:50:18 +08:00
parent 699fa4c458
commit 1afbe0e44d
3 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -553,10 +553,10 @@ func (manager *SPolicyManager) AllPolicies() map[string][]string {
}
func (manager *SPolicyManager) RoleMatchPolicies(roleName string) []string {
ident := rbacutils.NewRbacIdentity("", "", []string{roleName})
ret := make([]string, 0)
for _, policies := range manager.policies {
for i := range policies {
ident := rbacutils.NewRbacIdentity("", "", []string{roleName})
if matched, _ := policies[i].Policy.Match(ident); matched {
ret = append(ret, policies[i].Name)
}