code: func (r *DefaultRuleResolver) GetRoleReferenceRules(roleRef rbacv1.RoleRef, bindingNamespace string) ([]rbacv1.PolicyRule, error) {
  	switch roleRef.Kind {
  	case "Role":
  		role, err := r.roleGetter.GetRole(bindingNamespace, roleRef.Name)
  		if err != nil {
  			return nil, err
  		}
  		return role.Rules, nil
  
  	case "ClusterRole":
  		clusterRole, err := r.clusterRoleGetter.GetClusterRole(roleRef.Name)
  		if err != nil {
  			return nil, err
  		}
  		return clusterRole.Rules, nil
  
  	default:
  		return nil, fmt.Errorf("unsupported role reference kind: %q", roleRef.Kind)
  	}
  }
docs: // GetRoleReferenceRules attempts to resolve the RoleBinding or ClusterRoleBinding.