use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class GroupController method getGroups.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getGroups(RestListRequest requestList) throws JsonProcessingException {
this.getGroupValidator().validateRestListRequest(requestList);
PagedMetadata<GroupDto> result = this.getGroupService().getGroups(requestList);
this.getGroupValidator().validateRestListResult(requestList, result);
logger.debug("Main Response -> {}", 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 GroupController method updateGroup.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{groupCode}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> updateGroup(@PathVariable String groupCode, @Valid @RequestBody GroupRequest groupRequest, BindingResult bindingResult) {
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
this.getGroupValidator().validateBodyName(groupCode, groupRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
GroupDto group = this.getGroupService().updateGroup(groupCode, groupRequest.getName());
return new ResponseEntity<>(new RestResponse(group), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class GuiFragmentController method getGuiFragments.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getGuiFragments(RestListRequest requestList) throws JsonProcessingException {
this.getGuiFragmentValidator().validateRestListRequest(requestList);
PagedMetadata<GuiFragmentDtoSmall> result = this.getGuiFragmentService().getGuiFragments(requestList);
this.getGuiFragmentValidator().validateRestListResult(requestList, result);
logger.debug("Main Response -> {}", 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 GuiFragmentController method addGuiFragment.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> addGuiFragment(@Valid @RequestBody GuiFragmentRequestBody guiFragmentRequest, BindingResult bindingResult) throws ApsSystemException {
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
// business validations
this.getGuiFragmentValidator().validate(guiFragmentRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
GuiFragmentDto fragment = this.getGuiFragmentService().addGuiFragment(guiFragmentRequest);
return new ResponseEntity<>(new RestResponse(fragment), HttpStatus.OK);
}
use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.
the class GuiFragmentController method deleteGuiFragment.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{fragmentCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deleteGuiFragment(@PathVariable String fragmentCode) throws ApsSystemException {
logger.info("deleting {}", fragmentCode);
this.getGuiFragmentService().removeGuiFragment(fragmentCode);
Map<String, String> result = new HashMap<>();
result.put("code", fragmentCode);
return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
Aggregations