use of org.graylog.security.shares.EntityShareResponse in project graylog2-server by Graylog2.
the class EntitySharesResource method updateEntityShares.
@POST
@ApiOperation(value = "Create / update shares for an entity or collection")
@Path("entities/{entityGRN}")
@NoAuditEvent("Audit events are created within EntitySharesService")
public Response updateEntityShares(@ApiParam(name = "entityGRN", required = true) @PathParam("entityGRN") @NotBlank String entityGRN, @ApiParam(name = "JSON Body", required = true) @NotNull @Valid EntityShareRequest request) {
final GRN entity = grnRegistry.parse(entityGRN);
checkOwnership(entity);
final EntityShareResponse entityShareResponse = entitySharesService.updateEntityShares(entity, request, requireNonNull(getCurrentUser()));
if (entityShareResponse.validationResult().failed()) {
return Response.status(Response.Status.BAD_REQUEST).entity(entityShareResponse).build();
} else {
return Response.ok(entityShareResponse).build();
}
}
Aggregations