remove dead code in rbac helper

This commit is contained in:
xilabao 2017-06-22 17:48:54 +08:00
parent a57c33bd28
commit ece3188507

View File

@ -215,9 +215,8 @@ func (r *PolicyRuleBuilder) Rule() (PolicyRule, error) {
return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule)
}
case len(r.PolicyRule.Resources) > 0:
if len(r.PolicyRule.NonResourceURLs) != 0 {
return PolicyRule{}, fmt.Errorf("resource rule may not have nonResourceURLs: %#v", r.PolicyRule)
}
// resource rule may not have nonResourceURLs
if len(r.PolicyRule.APIGroups) == 0 {
// this a common bug
return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule)