use of org.craftercms.studio.model.rest.ResponseBody in project studio by craftercms.
the class SecurityController method encryptText.
@PostMapping("/encrypt")
public ResponseBody encryptText(@RequestBody EncryptRequest request) throws ServiceLayerException {
String encrypted = encryptionService.encrypt(request.getSiteId(), request.getText());
ResultOne<String> result = new ResultOne<>();
result.setEntity(RESULT_KEY_ITEM, encrypted);
result.setResponse(ApiResponse.OK);
ResponseBody response = new ResponseBody();
response.setResult(result);
return response;
}
use of org.craftercms.studio.model.rest.ResponseBody in project studio by craftercms.
the class SitesController method createSite.
@PostMapping("/create_site_from_marketplace")
public ResponseBody createSite(@Valid @RequestBody CreateSiteRequest request) throws RemoteRepositoryNotFoundException, InvalidRemoteRepositoryException, ServiceLayerException, InvalidRemoteRepositoryCredentialsException, InvalidRemoteUrlException, RemoteRepositoryNotBareException {
marketplaceService.createSite(request);
Result result = new Result();
result.setResponse(ApiResponse.CREATED);
ResponseBody response = new ResponseBody();
response.setResult(result);
return response;
}
use of org.craftercms.studio.model.rest.ResponseBody in project studio by craftercms.
the class UiController method getActiveEnvironment.
@GetMapping("/system/active_environment")
public ResponseBody getActiveEnvironment() throws AuthenticationException {
ResultOne<String> result = new ResultOne<String>();
result.setResponse(ApiResponse.OK);
result.setEntity(RESULT_KEY_ENVIRONMENT, uiService.getActiveEnvironment());
ResponseBody responseBody = new ResponseBody();
responseBody.setResult(result);
return responseBody;
}
use of org.craftercms.studio.model.rest.ResponseBody in project studio by craftercms.
the class UsersController method resetPassword.
@PostMapping(PATH_PARAM_ID + RESET_PASSWORD)
public ResponseBody resetPassword(@PathVariable(REQUEST_PARAM_ID) String userId, @RequestBody ResetPasswordRequest resetPasswordRequest) throws UserNotFoundException, UserExternallyManagedException, ServiceLayerException {
userService.resetPassword(resetPasswordRequest.getUsername(), resetPasswordRequest.getNewPassword());
ResponseBody responseBody = new ResponseBody();
Result result = new Result();
result.setResponse(OK);
responseBody.setResult(result);
return responseBody;
}
use of org.craftercms.studio.model.rest.ResponseBody in project studio by craftercms.
the class UsersController method enableUsers.
/**
* Enable users API
*
* @param enableUsers Enable users request body (json representation)
* @return Response object
*/
@PatchMapping(value = ENABLE, consumes = APPLICATION_JSON_VALUE)
public ResponseBody enableUsers(@RequestBody EnableUsers enableUsers) throws ServiceLayerException, UserNotFoundException, AuthenticationException {
ValidationUtils.validateEnableUsers(enableUsers);
List<User> users = userService.enableUsers(enableUsers.getIds(), enableUsers.getUsernames(), true);
ResponseBody responseBody = new ResponseBody();
ResultList<User> result = new ResultList<>();
result.setResponse(OK);
result.setEntities(RESULT_KEY_USERS, users);
responseBody.setResult(result);
return responseBody;
}
Aggregations