use of org.sonarqube.ws.Permissions.UsersWsResponse in project sonarqube by SonarSource.
the class UsersAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<ComponentDto> project = wsSupport.findProject(dbSession, request);
wsSupport.checkPermissionManagementAccess(userSession, project.orElse(null));
PermissionQuery query = buildPermissionQuery(request, project.orElse(null));
List<UserDto> users = findUsers(dbSession, query);
int total = dbClient.userPermissionDao().countUsersByQuery(dbSession, query);
List<UserPermissionDto> userPermissions = findUserPermissions(dbSession, users, project.orElse(null));
Paging paging = Paging.forPageIndex(request.mandatoryParamAsInt(Param.PAGE)).withPageSize(query.getPageSize()).andTotal(total);
UsersWsResponse usersWsResponse = buildResponse(users, userPermissions, paging);
writeProtobuf(usersWsResponse, request, response);
}
}
Aggregations