use of org.graylog2.rest.models.users.responses.UserList in project graylog2-server by Graylog2.
the class UsersResource method listUsers.
@GET
@Deprecated
@RequiresPermissions(RestPermissions.USERS_LIST)
@ApiOperation(value = "List all users", notes = "The permissions assigned to the users are always included.")
public UserList listUsers() {
final List<User> users = userManagementService.loadAll();
final AllUserSessions sessions = AllUserSessions.create(sessionService);
final List<UserSummary> resultUsers = Lists.newArrayListWithCapacity(users.size() + 1);
userManagementService.getRootUser().ifPresent(adminUser -> resultUsers.add(toUserResponse(adminUser, sessions)));
for (User user : users) {
resultUsers.add(toUserResponse(user, sessions));
}
return UserList.create(resultUsers);
}
use of org.graylog2.rest.models.users.responses.UserList in project graylog2-server by Graylog2.
the class AuthServiceBackendsResource method getUsers.
@GET
@Path("{backendId}/users")
@ApiOperation("Get paginated users for an authentication service backend")
@RequiresPermissions({ RestPermissions.AUTH_SERVICE_GLOBAL_CONFIG_READ, RestPermissions.USERS_READ })
public PaginatedResponse<UserOverviewDTO> getUsers(@ApiParam(name = "page") @QueryParam("page") @DefaultValue("1") int page, @ApiParam(name = "per_page") @QueryParam("per_page") @DefaultValue("50") int perPage, @ApiParam(name = "query") @QueryParam("query") @DefaultValue("") String query, @ApiParam(name = "sort", value = "The field to sort the result on", required = true, allowableValues = "username,full_name,email") @DefaultValue(UserOverviewDTO.FIELD_FULL_NAME) @QueryParam("sort") String sort, @ApiParam(name = "order", value = "The sort direction", allowableValues = "asc, desc") @DefaultValue("asc") @QueryParam("order") String order, @ApiParam(name = "backendId", required = true) @PathParam("backendId") @NotBlank String backendId) {
final AuthServiceBackendDTO activeConfig = loadConfig(backendId);
final PaginatedList<UserOverviewDTO> userList = userService.findPaginatedByAuthServiceBackend(parseSearchQuery(query), page, perPage, sort, order, activeConfig.id());
return PaginatedResponse.create("users", userList, query, Collections.singletonMap("roles", createRoleContext(userList.delegate())));
}
Aggregations