コード例 #1
0
 @TimedResource
 @POST
 @Path("/users")
 @Consumes(APPLICATION_JSON)
 @Produces(APPLICATION_JSON)
 @ApiOperation(value = "Add a new user with roles (to make api requests)")
 public Response addUserRoles(
     final UserRolesJson json,
     @HeaderParam(HDR_CREATED_BY) final String createdBy,
     @HeaderParam(HDR_REASON) final String reason,
     @HeaderParam(HDR_COMMENT) final String comment,
     @javax.ws.rs.core.Context final HttpServletRequest request,
     @javax.ws.rs.core.Context final UriInfo uriInfo)
     throws SecurityApiException {
   securityApi.addUserRoles(
       json.getUsername(),
       json.getPassword(),
       json.getRoles(),
       context.createContext(createdBy, reason, comment, request));
   return Response.status(Status.CREATED).build();
 }
コード例 #2
0
 @TimedResource
 @PUT
 @Consumes(APPLICATION_JSON)
 @Produces(APPLICATION_JSON)
 @Path("/users/{username:"******"}/roles")
 @ApiOperation(value = "Update roles associated to a user")
 public Response updateUserRoles(
     final UserRolesJson json,
     @PathParam("username") final String username,
     @HeaderParam(HDR_CREATED_BY) final String createdBy,
     @HeaderParam(HDR_REASON) final String reason,
     @HeaderParam(HDR_COMMENT) final String comment,
     @javax.ws.rs.core.Context final HttpServletRequest request,
     @javax.ws.rs.core.Context final UriInfo uriInfo)
     throws SecurityApiException {
   securityApi.updateUserRoles(
       username, json.getRoles(), context.createContext(createdBy, reason, comment, request));
   return Response.status(Status.OK).build();
 }