@Path("{id}/disable/api")
@Consumes(MediaType.APPLICATION_JSON)
public Response disableInboundAPIForAccount(@PathParam("id") ObjectId id) {
try {
Account account = userService.getAccount(id);
// TODO: need a better way to lock this...
User superUser = userService.getSuperUser();
if (superUser.getAccount().getId().equals(id)) {
return error("Can not disable Nodeable account.", Response.status(Response.Status.BAD_REQUEST));
}
account.setConfigValue(Account.ConfigKey.DISABLE_INBOUND_API, true);
userService.updateAccount(account);
} catch (AccountNotFoundException e) {
return error("Account not found.", Response.status(Response.Status.BAD_REQUEST));
}
return Response.status(Response.Status.NO_CONTENT).build();