/** * Gets the roles which shouldn't have members but a user belongs to. * @param userId * @return A set of role IDs. By convention these should all start with a dot ("."). */ Set<String> getEmptyRoles(String userId) { Set<String> roles = new HashSet<String>(); roles.add(ANON_ROLE); if ((userId != null) && (!userDirectoryService().getAnonymousUser().getId().equals(userId))) { // A dummy user is created to test role access instead of loading all of the roles and iterating over them. String roleId = decodeRoleFromDummyUser(userId); if (roleId != null){ roles.remove(ANON_ROLE); roles.add(roleId); } else { roles.add(AUTH_ROLE); // Get additional roles from provider if (m_roleProvider != null) { roles.addAll((m_roleProvider.getAdditionalRoles(userId))); } } } return roles; }