Search in sources :

Example 1 with RangerAnnotationRestAPI

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());
    }
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) RangerAnnotationRestAPI(org.apache.ranger.common.annotation.RangerAnnotationRestAPI) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) PUT(javax.ws.rs.PUT)

Aggregations

Consumes (javax.ws.rs.Consumes)1 PUT (javax.ws.rs.PUT)1 Produces (javax.ws.rs.Produces)1 RangerAnnotationRestAPI (org.apache.ranger.common.annotation.RangerAnnotationRestAPI)1 XXPortalUser (org.apache.ranger.entity.XXPortalUser)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1