region > findByRole (programmatic)
329583
@Programmatic
    public List<ApplicationPermission> findByRoleCached(final ApplicationRole role) {
        return queryResultsCache.execute(new Callable<List<ApplicationPermission>>() {
            @Override
            public List<ApplicationPermission> call() throws Exception {
                return findByRole(role);
            }
        }, ApplicationPermissionRepository.class, "findByRoleCached", role);
    }
242881
public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) {
    return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles);
  }
1106412
@Override
	public List<WebElement> findElements(final By by) {
		return wef.by(by).findAll();
	}
999327
@Override
    public boolean isUserInRole(String role) {
        if (userRoles == null) {
            return false;
        }

        return userRoles.contains(role);
    }
713193
def role_search(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.search_roles(**kwargs)
1053714
def _getRole(self, matchedVars):
        
        role = matchedVars.get(ROLE)
        if role is not None and role.strip() == '':
            role = NULL
        else:
            valid = Authoriser.isValidRoleName(role)
            if valid:
                role = Authoriser.getRoleFromName(role)
            else:
                self.print("Invalid role. Valid roles are: {}".
                           format(", ".join(map(lambda r: r.name, Roles))),
                           Token.Error)
                return False
        return role
283844
@Programmatic
    public Paperclip findByDocumentAndAttachedToAndRoleName(
            final DocumentAbstract<?> document,
            final Object attachedTo,
            final String roleName) {
        if(document == null) {
            return null;
        }
        if(attachedTo == null) {
            return null;
        }
        if(roleName == null) {
            return null;
        }
        final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
        if(bookmark == null) {
            return null;
        }
        final String attachedToStr = bookmark.toString();
        return repositoryService.firstMatch(
                new QueryDefault<>(Paperclip.class,
                        "findByDocumentAndAttachedToAndRoleName",
                        "document", document,
                        "attachedToStr", attachedToStr,
                        "roleName", roleName));
    }
459650
@Programmatic
    public ApplicationRole newRole(
            final String name,
            final String description) {
        ApplicationRole role = findByName(name);
        if (role == null){
            role = getApplicationRoleFactory().newApplicationRole();
            role.setName(name);
            role.setDescription(description);
            container.persist(role);
        }
        return role;
    }
1234972
public Set<Role> findRoles(final User user)
    {
        final Set<Role> result = new HashSet<Role>();
        
        for(final RoleMapping mapping : this.getRoleMappings())
        {
            final Object source = mapping.getSource();
            
            if((user != null) && user.equals(source))
            {
                // TODO: Fix this hardcoding when Restlet implements equals for Role objects again
                RestletUtilRole standardRole = this.getRoleByName(mapping.getTarget().getName());
                if(standardRole != null)
                {
                    result.add(standardRole.getRole());
                }
                else
                {
                    result.add(mapping.getTarget());
                }
            }
        }
        
        return result;
    }
1057656
public List<ResourceCollection> getByRole(Roles role)
  {
    return role == null ? ImmutableList.<ResourceCollection> of() : getByRole(role.toString());
  }
853287
function getRole(user) {
      user = user || getCurrentUser();
      return _.find(userRoles, {role: user.role});
    }
301604
public Map<String, Role> getRoles(String tenant) {
        if (!roles.containsKey(tenant)) {
            return new HashMap<>();
        }
        return roles.get(tenant);
    }
1202548
private static Set<String> extractUserRoles(final UsersType.User user) {
        Set<String> roles = new TreeSet<>();
        if (user == null) {
            return roles;
        }

        if (user.getRoles() != null && !user.getRoles().trim().isEmpty()) {
            String [] rolelist = user.getRoles().trim().split(",");
            for (String role: rolelist) {
                if( role == null || role.trim().isEmpty()) {
                    continue;
                }
                roles.add(role.trim().toLowerCase());
            }
        }

        return roles;
    }
581832
public String extractRole(XEvent event) {
		XAttribute attribute = event.getAttributes().get(KEY_ROLE);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeLiteral) attribute).getValue();
		}
	}
571434
@SuppressWarnings("unchecked")
    protected List getUserRoles(DirContext dirContext, String username) throws LoginException,
            NamingException {
        String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn;

        return getUserRolesByDn(dirContext, userDn, username);
    }
759348
async function findRoleUsers (roleId, roleMembershipModel, rbac) {
  const userIds = [ ]
  for (const inheritedRoleId of rbac.inheritedBy[roleId]) {
    userIds.push(...await findUserIds(inheritedRoleId, roleMembershipModel))
  } // for ...

  return uniqify(userIds)
}
1124046
public Object getComponent(String role, String roleHint) throws ComponentLookupException {
        return container.lookup(role, roleHint);
    }