return this.search(criteria);
}
private UserSearchCriteria toPlexusSearchCriteria(PlexusUserSearchCriteriaResource criteriaResource) {
UserSearchCriteria criteria = new UserSearchCriteria();
criteria.setUserId(criteriaResource.getUserId());
// NOTE: in the future we could expand the REST resource to send back a list of roles, (or a single role)
// to get a list of all users of Role 'XYZ'
if (criteriaResource.isEffectiveUsers()) {
Set<String> roleIds = new HashSet<String>();
Set<Role> roles = null;
try {
roles = this.getSecuritySystem().listRoles("default");
}
catch (NoSuchAuthorizationManagerException e) {
this.getLogger().error("Cannot find default UserManager, effective user search may not work properly.",
e);
roles = this.getSecuritySystem().listRoles();
}
for (Role role : roles) {
roleIds.add(role.getRoleId());
}
criteria.setOneOfRoleIds(roleIds);
}
return criteria;
}