Search in sources :

Example 41 with XXPortalUser

use of org.apache.ranger.entity.XXPortalUser in project ranger by apache.

the class XAuditMapService method mapEntityToViewBean.

@Override
protected VXAuditMap mapEntityToViewBean(VXAuditMap vObj, XXAuditMap mObj) {
    if (mObj != null && vObj != null) {
        super.mapEntityToViewBean(vObj, mObj);
        XXPortalUser xXPortalUser = null;
        if (stringUtil.isEmpty(vObj.getOwner())) {
            xXPortalUser = daoManager.getXXPortalUser().getById(mObj.getAddedByUserId());
            if (xXPortalUser != null) {
                vObj.setOwner(xXPortalUser.getLoginId());
            }
        }
        if (stringUtil.isEmpty(vObj.getUpdatedBy())) {
            xXPortalUser = daoManager.getXXPortalUser().getById(mObj.getUpdatedByUserId());
            if (xXPortalUser != null) {
                vObj.setUpdatedBy(xXPortalUser.getLoginId());
            }
        }
    }
    return vObj;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser)

Example 42 with XXPortalUser

use of org.apache.ranger.entity.XXPortalUser in project ranger by apache.

the class XGroupService method createXGroupWithOutLogin.

public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) {
    XXGroup xxGroup = daoManager.getXXGroup().findByGroupName(vxGroup.getName());
    boolean groupExists = true;
    if (xxGroup == null) {
        xxGroup = new XXGroup();
        groupExists = false;
    }
    xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0);
    XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(createdByUserId);
    if (xXPortalUser != null) {
        xxGroup.setAddedByUserId(createdByUserId);
        xxGroup.setUpdatedByUserId(createdByUserId);
    }
    if (groupExists) {
        xxGroup = getDao().update(xxGroup);
    } else {
        xxGroup = getDao().create(xxGroup);
    }
    vxGroup = postCreate(xxGroup);
    return vxGroup;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser) XXGroup(org.apache.ranger.entity.XXGroup)

Example 43 with XXPortalUser

use of org.apache.ranger.entity.XXPortalUser in project ranger by apache.

the class XPermMapService method mapViewToEntityBean.

@Override
protected XXPermMap mapViewToEntityBean(VXPermMap vObj, XXPermMap mObj, int OPERATION_CONTEXT) {
    if (vObj != null && mObj != null) {
        super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
        XXPortalUser xXPortalUser = null;
        if (mObj.getAddedByUserId() == null || mObj.getAddedByUserId() == 0) {
            if (!stringUtil.isEmpty(vObj.getOwner())) {
                xXPortalUser = daoManager.getXXPortalUser().findByLoginId(vObj.getOwner());
                if (xXPortalUser != null) {
                    mObj.setAddedByUserId(xXPortalUser.getId());
                }
            }
        }
        if (mObj.getUpdatedByUserId() == null || mObj.getUpdatedByUserId() == 0) {
            if (!stringUtil.isEmpty(vObj.getUpdatedBy())) {
                xXPortalUser = daoManager.getXXPortalUser().findByLoginId(vObj.getUpdatedBy());
                if (xXPortalUser != null) {
                    mObj.setUpdatedByUserId(xXPortalUser.getId());
                }
            }
        }
    }
    return mObj;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser)

Example 44 with XXPortalUser

use of org.apache.ranger.entity.XXPortalUser in project ranger by apache.

the class XResourceService method mapViewToEntityBean.

@Override
protected XXResource mapViewToEntityBean(VXResource vObj, XXResource mObj, int OPERATION_CONTEXT) {
    if (vObj != null && mObj != null) {
        super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
        mObj.setUdfs(vObj.getUdfs());
        XXPortalUser xXPortalUser = null;
        if (mObj.getAddedByUserId() == null || mObj.getAddedByUserId() == 0) {
            if (!stringUtil.isEmpty(vObj.getOwner())) {
                xXPortalUser = daoManager.getXXPortalUser().findByLoginId(vObj.getOwner());
                if (xXPortalUser != null) {
                    mObj.setAddedByUserId(xXPortalUser.getId());
                }
            }
        }
        if (mObj.getUpdatedByUserId() == null || mObj.getUpdatedByUserId() == 0) {
            if (!stringUtil.isEmpty(vObj.getUpdatedBy())) {
                xXPortalUser = daoManager.getXXPortalUser().findByLoginId(vObj.getUpdatedBy());
                if (xXPortalUser != null) {
                    mObj.setUpdatedByUserId(xXPortalUser.getId());
                }
            }
        }
    }
    return mObj;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser)

Example 45 with XXPortalUser

use of org.apache.ranger.entity.XXPortalUser in project ranger by apache.

the class XTrxLogService method mapEntityToViewBean.

@Override
protected VXTrxLog mapEntityToViewBean(VXTrxLog vObj, XXTrxLog mObj) {
    if (mObj != null && vObj != null) {
        super.mapEntityToViewBean(vObj, mObj);
        XXPortalUser xXPortalUser = null;
        if (stringUtil.isEmpty(vObj.getOwner())) {
            xXPortalUser = daoManager.getXXPortalUser().getById(mObj.getAddedByUserId());
            if (xXPortalUser != null) {
                vObj.setOwner(xXPortalUser.getLoginId());
            }
        }
        if (stringUtil.isEmpty(vObj.getUpdatedBy())) {
            xXPortalUser = daoManager.getXXPortalUser().getById(mObj.getUpdatedByUserId());
            if (xXPortalUser != null) {
                vObj.setUpdatedBy(xXPortalUser.getLoginId());
            }
        }
    }
    return vObj;
}
Also used : XXPortalUser(org.apache.ranger.entity.XXPortalUser)

Aggregations

XXPortalUser (org.apache.ranger.entity.XXPortalUser)98 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)39 XXPortalUserDao (org.apache.ranger.db.XXPortalUserDao)32 VXPortalUser (org.apache.ranger.view.VXPortalUser)30 VXString (org.apache.ranger.view.VXString)26 XXPortalUserRole (org.apache.ranger.entity.XXPortalUserRole)21 XXPortalUserRoleDao (org.apache.ranger.db.XXPortalUserRoleDao)19 Date (java.util.Date)15 XXUserPermission (org.apache.ranger.entity.XXUserPermission)14 XXModuleDef (org.apache.ranger.entity.XXModuleDef)12 XXUser (org.apache.ranger.entity.XXUser)12 UserSessionBase (org.apache.ranger.common.UserSessionBase)11 XXGroupPermission (org.apache.ranger.entity.XXGroupPermission)11 VXUserPermission (org.apache.ranger.view.VXUserPermission)10 XXUserPermissionDao (org.apache.ranger.db.XXUserPermissionDao)9 VXGroupPermission (org.apache.ranger.view.VXGroupPermission)9 RangerSecurityContext (org.apache.ranger.security.context.RangerSecurityContext)8 XXGroupPermissionDao (org.apache.ranger.db.XXGroupPermissionDao)7 XXTrxLog (org.apache.ranger.entity.XXTrxLog)7