checkProjectAdminUserByComponentDto(userSession, project);
PermissionQuery permissionQuery = buildPermissionQuery(request, project);
Long projectIdIfPresent = project.isPresent() ? project.get().getId() : null;
int total = dbClient.permissionDao().countUsers(dbSession, permissionQuery, projectIdIfPresent);
List<UserWithPermissionDto> usersWithPermission = permissionFinder.findUsersWithPermission(dbSession, permissionQuery);
<BUG>WsUsersResponse wsUsersResponse = buildResponse(usersWithPermission, forPageIndex(request.page()).withPageSize(request.pageSize()).andTotal(total));

writeProtobuf(wsUsersResponse, wsRequest, wsResponse);</BUG>
} finally {
dbClient.closeSession(dbSession);

checkProjectAdminUserByComponentDto(userSession, project);
PermissionQuery permissionQuery = buildPermissionQuery(request, project);
Long projectIdIfPresent = project.isPresent() ? project.get().getId() : null;
int total = dbClient.permissionDao().countUsers(dbSession, permissionQuery, projectIdIfPresent);
List<UserWithPermissionDto> usersWithPermission = permissionFinder.findUsersWithPermission(dbSession, permissionQuery);
return buildResponse(usersWithPermission, forPageIndex(request.getPage()).withPageSize(request.getPageSize()).andTotal(total));
} finally {
dbClient.closeSession(dbSession);
