Class UsersResource
java.lang.Object
org.graylog2.shared.rest.resources.RestResource
org.graylog2.rest.resources.users.UsersResource
@RequiresAuthentication
@Path("/users")
@Consumes("application/json")
@Produces("application/json")
public class UsersResource
extends RestResource
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final com.google.common.collect.ImmutableMap<String,
SearchQueryField> Fields inherited from class org.graylog2.shared.rest.resources.RestResource
configuration, userService
-
Constructor Summary
ConstructorDescriptionUsersResource
(UserManagementService userManagementService, PaginatedUserService paginatedUserService, AccessTokenService accessTokenService, RoleService roleService, MongoDBSessionService sessionService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
changePassword
(String userId, @Valid ChangePasswordRequest cr) void
changeUser
(String userId, @Valid @NotNull ChangeUserRequest cr) javax.ws.rs.core.Response
create
(@Valid @NotNull CreateUserRequest cr) void
deletePermissions
(String username) void
deleteUser
(String username) void
deleteUserById
(String userId) void
editPermissions
(String username, @Valid @NotNull PermissionEditRequest permissionRequest) generateNewToken
(String userId, String name, String body) get
(String username, UserContext userContext) Deprecated.getbyId
(String userId, UserContext userContext) listTokens
(String userId) listUsers
(boolean includePermissions, boolean includeSessions) Deprecated.Use the paginated call insteadvoid
revokeToken
(String userId, String idOrToken) void
savePreferences
(String username, UpdateUserPreferences preferencesRequest) javax.ws.rs.core.Response
updateAccountStatus
(@NotBlank String userId, @NotBlank String newStatusString, UserContext userContext) Methods inherited from class org.graylog2.shared.rest.resources.RestResource
checkAnyPermission, checkPermission, checkPermission, getCurrentUser, getIndexSet, getSubject, getUriBuilderToSelf, isAnyPermitted, isAnyPermitted, isPermitted, isPermitted, setPrettyPrint
-
Field Details
-
SEARCH_FIELD_MAPPING
protected static final com.google.common.collect.ImmutableMap<String,SearchQueryField> SEARCH_FIELD_MAPPING
-
-
Constructor Details
-
Method Details
-
get
@GET @Deprecated @Path("{username}") public UserSummary get(@PathParam("username") String username, @Context UserContext userContext) Deprecated. -
getbyId
@GET @Path("id/{userId}") public UserSummary getbyId(@PathParam("userId") String userId, @Context UserContext userContext) -
listUsers
@GET @Deprecated @RequiresPermissions("users:list") public UserList listUsers(@QueryParam("include_permissions") @DefaultValue("true") boolean includePermissions, @QueryParam("include_sessions") @DefaultValue("true") boolean includeSessions) Deprecated.Use the paginated call instead -
getPage
@GET @Timed @Path("/paginated") @RequiresPermissions("users:list") @Produces("application/json") public PaginatedResponse<UserOverviewDTO> getPage(@QueryParam("page") @DefaultValue("1") int page, @QueryParam("per_page") @DefaultValue("50") int perPage, @QueryParam("query") @DefaultValue("") String query, @DefaultValue("full_name") @QueryParam("sort") String sort, @DefaultValue("asc") @QueryParam("order") String order) -
create
@POST @RequiresPermissions("users:create") public javax.ws.rs.core.Response create(@Valid @NotNull @Valid @NotNull CreateUserRequest cr) throws ValidationException - Throws:
ValidationException
-
deleteUser
@DELETE @Path("{username}") @RequiresPermissions("users:edit") public void deleteUser(@PathParam("username") String username) -
deleteUserById
@DELETE @Path("id/{userId}") @RequiresPermissions("users:edit") public void deleteUserById(@PathParam("userId") String userId) -
editPermissions
@PUT @Path("{username}/permissions") @RequiresPermissions("users:permissionsedit") public void editPermissions(@PathParam("username") String username, @Valid @NotNull @Valid @NotNull PermissionEditRequest permissionRequest) throws ValidationException - Throws:
ValidationException
-
savePreferences
@PUT @Path("{username}/preferences") public void savePreferences(@PathParam("username") String username, UpdateUserPreferences preferencesRequest) throws ValidationException - Throws:
ValidationException
-
deletePermissions
@DELETE @Path("{username}/permissions") @RequiresPermissions("users:permissionsedit") public void deletePermissions(@PathParam("username") String username) throws ValidationException - Throws:
ValidationException
-
changePassword
@PUT @Path("{userId}/password") public void changePassword(@PathParam("userId") String userId, @Valid @Valid ChangePasswordRequest cr) throws ValidationException - Throws:
ValidationException
-
updateAccountStatus
@PUT @Path("{userId}/status/{newStatus}") @Consumes("*/*") public javax.ws.rs.core.Response updateAccountStatus(@PathParam("userId") @NotBlank @NotBlank String userId, @PathParam("newStatus") @NotBlank @NotBlank String newStatusString, @Context UserContext userContext) throws ValidationException - Throws:
ValidationException
-
listTokens
-
generateNewToken
-
revokeToken
-