code: func (pl PolicyList) RulesFor(user user.Info, namespace string) ([]authorizer.ResourceRuleInfo, []authorizer.NonResourceRuleInfo, bool, error) {
  	var (
  		resourceRules    []authorizer.ResourceRuleInfo
  		nonResourceRules []authorizer.NonResourceRuleInfo
  	)
  
  	for _, p := range pl {
  		if subjectMatches(*p, user) {
  			if p.Spec.Namespace == "*" || p.Spec.Namespace == namespace {
  				if len(p.Spec.Resource) > 0 {
  					r := authorizer.DefaultResourceRuleInfo{
  						Verbs:     getVerbs(p.Spec.Readonly),
  						APIGroups: []string{p.Spec.APIGroup},
  						Resources: []string{p.Spec.Resource},
  					}
  					var resourceRule authorizer.ResourceRuleInfo = &r
  					resourceRules = append(resourceRules, resourceRule)
  				}
  				if len(p.Spec.NonResourcePath) > 0 {
  					r := authorizer.DefaultNonResourceRuleInfo{
  						Verbs:           getVerbs(p.Spec.Readonly),
  						NonResourceURLs: []string{p.Spec.NonResourcePath},
  					}
  					var nonResourceRule authorizer.NonResourceRuleInfo = &r
  					nonResourceRules = append(nonResourceRules, nonResourceRule)
  				}
  			}
  		}
  	}
  	return resourceRules, nonResourceRules, false, nil
  }
docs: // RulesFor returns rules for the given user and namespace.