Search in sources :

Example 6 with GroupUtilizer

use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.

the class AuthorizationService method getGroupUtilizer.

@Override
public List<UserDto> getGroupUtilizer(String groupCode) {
    try {
        List<String> usernames = ((GroupUtilizer<String>) this.getAuthorizationManager()).getGroupUtilizers(groupCode);
        List<UserDto> dtoList = new ArrayList<>();
        if (null != usernames) {
            usernames.stream().forEach(i -> {
                try {
                    dtoList.add(this.getDtoBuilder().convert(this.getUserManager().getUser(i)));
                } catch (ApsSystemException e) {
                    logger.error("error loading {}", i, e);
                }
            });
        }
        return dtoList;
    } catch (ApsSystemException ex) {
        logger.error("Error loading user references for group {}", groupCode, ex);
        throw new RestServerError("Error loading user references by group", ex);
    }
}
Also used : UserDto(org.entando.entando.aps.system.services.user.model.UserDto) RestServerError(org.entando.entando.aps.system.exception.RestServerError) ArrayList(java.util.ArrayList) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) GroupUtilizer(com.agiletec.aps.system.services.group.GroupUtilizer)

Aggregations

GroupUtilizer (com.agiletec.aps.system.services.group.GroupUtilizer)6 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)4 List (java.util.List)3 RestServerError (org.entando.entando.aps.system.exception.RestServerError)3 HashMap (java.util.HashMap)2 ArrayList (java.util.ArrayList)1 UserDto (org.entando.entando.aps.system.services.user.model.UserDto)1