code: public boolean hasRole(String roleName){
          if (roles != null) {
              for (String r : roles) {
                  if (r.equals(roleName))
                      return true;
              }
          }
          return false;
      }
docs: Check whether the group has the specified role.