use of org.craftercms.profile.management.exceptions.ResourceNotFoundException in project profile by craftercms.
the class ProfileController method deleteProfile.
@RequestMapping(value = URL_DELETE_PROFILE, method = RequestMethod.POST)
@ResponseBody
public Map<String, String> deleteProfile(@PathVariable(PATH_VAR_ID) String id) throws ProfileException {
Profile profile = profileService.getProfile(id);
if (profile != null) {
checkIfAllowed(profile, Action.DELETE_PROFILE);
profileService.deleteProfile(id);
return Collections.singletonMap(MODEL_MESSAGE, String.format(MSG_PROFILE_DELETED_FORMAT, id));
} else {
throw new ResourceNotFoundException("No profile found for ID '" + id + "'");
}
}
Aggregations