mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix: policy allow if one of the matching rules is allow
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user