use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class UserSettingsController method getUserSettings.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getUserSettings() {
logger.debug("loading user settings");
UserSettingsDto userSettings = this.getUserSettingsService().getUserSettings();
return new ResponseEntity<>(new RestResponse(userSettings), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class WidgetController method updateWidget.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets/{widgetCode}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget")
public ResponseEntity<RestResponse> updateWidget(@PathVariable String widgetCode, @Valid @RequestBody WidgetRequest widgetRequest, BindingResult bindingResult) {
logger.trace("update widget. Code: {} and body {}: ", widgetCode, widgetRequest);
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
this.widgetValidator.validateWidgetCode(widgetCode, widgetRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
WidgetDto widgetDto = this.widgetService.updateWidget(widgetCode, widgetRequest);
return new ResponseEntity<>(new RestResponse(widgetDto), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class WidgetController method getWidgets.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getWidgets(RestListRequest requestList) {
logger.trace("get widget list {}", requestList);
this.getWidgetValidator().validateRestListRequest(requestList);
PagedMetadata<WidgetDto> result = this.widgetService.getWidgets(requestList);
this.getWidgetValidator().validateRestListResult(requestList, result);
return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class WidgetController method addWidget.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget")
public ResponseEntity<RestResponse> addWidget(@Valid @RequestBody WidgetRequest widgetRequest, BindingResult bindingResult) throws ApsSystemException {
logger.trace("add widget. body {}: ", widgetRequest);
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
// business validations
this.widgetValidator.validate(widgetRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
WidgetDto widgetDto = this.widgetService.addWidget(widgetRequest);
return new ResponseEntity<>(new RestResponse(widgetDto), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class DatabaseController method initBackup.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/initBackup", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> initBackup() {
logger.debug("Required actual component configuration");
List<ComponentDto> dtos = this.getDatabaseService().getCurrentComponents();
logger.debug("Actual component configuration -> {}", dtos);
return new ResponseEntity<>(new RestResponse(dtos), HttpStatus.OK);
}
Aggregations