use of org.bimserver.database.actions.GetAllUsersDatabaseAction in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllUsers.
@Override
public List<SUser> getAllUsers() throws ServerException, UserException {
if (getBimServer().getServerSettingsCache().getServerSettings().getHideUserListForNonAdmin()) {
if (getCurrentUser().getUserType() != SUserType.ADMIN) {
throw new UserException("Admin rights required to list users");
}
}
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Set<User>> action = new GetAllUsersDatabaseAction(session, getInternalAccessMethod(), getAuthorization());
List<SUser> convertToSListUser = getBimServer().getSConverter().convertToSListUser(session.executeAndCommitAction(action));
Collections.sort(convertToSListUser, new SUserComparator());
return convertToSListUser;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations