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 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
    • changeUser

      @PUT @Path("{userId}") public void changeUser(@PathParam("userId") String userId, @Valid @NotNull @Valid @NotNull ChangeUserRequest 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

      @GET @Path("{userId}/tokens") public TokenList listTokens(@PathParam("userId") String userId)
    • generateNewToken

      @POST @Path("{userId}/tokens/{name}") public Token generateNewToken(@PathParam("userId") String userId, @PathParam("name") String name, String body)
    • revokeToken

      @DELETE @Path("{userId}/tokens/{idOrToken}") public void revokeToken(@PathParam("userId") String userId, @PathParam("idOrToken") String idOrToken)