Skip to content

Commit

Permalink
fix: policy allow if one of the matching rules is allow
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiu Jian committed Jun 16, 2020
1 parent 818d40c commit 2efb7fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/cloudcommon/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,15 @@ func (manager *SPolicyManager) allowWithoutCache(scope rbacutils.TRbacScope, use

var result rbacutils.TRbacResult
if len(matchRules) > 0 {
rule := rbacutils.GetMatchRule(matchRules, service, resource, action, extra...)
result = rule.Result
result = rbacutils.Deny
for _, rule := range matchRules {
if rule.Result == rbacutils.Allow {
result = rbacutils.Allow
break
}
}
// rule := rbacutils.GetMatchRule(matchRules, service, resource, action, extra...)
// result = rule.Result
} else if findMatchPolicy {
// if find matched policy, but no rule matching, allow anyway
result = rbacutils.Allow
Expand Down

0 comments on commit 2efb7fc

Please sign in to comment.