use of org.apache.ranger.common.annotation.RangerAnnotationRestAPI in project ranger by apache.
the class UserREST method update.
@PUT
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
@RangerAnnotationRestAPI(updates_classes = "VUserProfile")
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.UPDATE + "\")")
public VXPortalUser update(VXPortalUser userProfile, @Context HttpServletRequest servletRequest) {
logger.info("update:" + userProfile.getEmailAddress());
XXPortalUser gjUser = daoManager.getXXPortalUser().getById(userProfile.getId());
userManager.checkAccess(gjUser);
if (gjUser != null) {
msRestUtil.validateVUserProfileForUpdate(gjUser, userProfile);
gjUser = userManager.updateUser(userProfile);
return userManager.mapXXPortalUserVXPortalUser(gjUser);
} else {
logger.info("update(): Invalid userId provided: userId=" + userProfile.getId());
throw restErrorUtil.createRESTException("serverMsg.userRestUser", MessageEnums.DATA_NOT_FOUND, null, null, userProfile.toString());
}
}
Aggregations