Search in sources :

Example 1 with UserSettingsDto

use of org.entando.entando.aps.system.services.usersettings.model.UserSettingsDto 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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) UserSettingsDto(org.entando.entando.aps.system.services.usersettings.model.UserSettingsDto) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with UserSettingsDto

use of org.entando.entando.aps.system.services.usersettings.model.UserSettingsDto in project entando-core by entando.

the class UserSettingsController method updateUserSettings.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> updateUserSettings(@Valid @RequestBody UserSettingsRequest request, BindingResult bindingResult) {
    logger.debug("updatinug user settings");
    // params validations
    if (bindingResult.hasErrors()) {
        throw new ValidationGenericException(bindingResult);
    }
    UserSettingsDto settings = this.getUserSettingsService().updateUserSettings(request);
    return new ResponseEntity<>(new RestResponse(settings), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) UserSettingsDto(org.entando.entando.aps.system.services.usersettings.model.UserSettingsDto) RestResponse(org.entando.entando.web.common.model.RestResponse) ValidationGenericException(org.entando.entando.web.common.exceptions.ValidationGenericException) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserSettingsDto (org.entando.entando.aps.system.services.usersettings.model.UserSettingsDto)2 RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)2 RestResponse (org.entando.entando.web.common.model.RestResponse)2 ResponseEntity (org.springframework.http.ResponseEntity)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)1