/** * Fetches just the Roles associated with the corresponding DefaultUserImpl. * * @param userId the id of the user * @return the DefaultUserImpl's set of Roles or an empty Set. */ public Set<ISecurityRole> getUserRoles(Long userId) { checkArgument(userId != null, "getUserRoles() requires a non-null userId parameter."); Iterator<UserRolePermissionJoinRow> baseResults = isEnabledColumnUsed() ? getEnabledUserRolesAndPermissions(userId) : getUserRolesAndPermissions(userId); DefaultUserImpl u = extractObjectGraphFromJoinResults(baseResults); return u != null ? u.getRoles() : Collections.<ISecurityRole>emptySet(); }
public Set<ISecurityRole> getUserRoles(String username) { DefaultUserImpl u = findUser(username); // We'd need to do a 4-way join anyway, so just call findUser() return u != null ? u.getRoles() : Collections.<ISecurityRole>emptySet(); }