Search in sources :

Example 1 with XXRoleRefRole

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

the class RoleRefUpdater method cleanupRefTables.

public Boolean cleanupRefTables(RangerRole rangerRole) {
    final Long roleId = rangerRole.getId();
    if (roleId == null) {
        return false;
    }
    XXRoleRefUserDao xRoleUserDao = daoMgr.getXXRoleRefUser();
    XXRoleRefGroupDao xRoleGroupDao = daoMgr.getXXRoleRefGroup();
    XXRoleRefRoleDao xRoleRoleDao = daoMgr.getXXRoleRefRole();
    for (XXRoleRefUser xxRoleRefUser : xRoleUserDao.findByRoleId(roleId)) {
        xRoleUserDao.remove(xxRoleRefUser);
    }
    for (XXRoleRefGroup xxRoleRefGroup : xRoleGroupDao.findByRoleId(roleId)) {
        xRoleGroupDao.remove(xxRoleRefGroup);
    }
    for (XXRoleRefRole xxRoleRefRole : xRoleRoleDao.findByRoleId(roleId)) {
        xRoleRoleDao.remove(xxRoleRefRole);
    }
    return true;
}
Also used : XXRoleRefRoleDao(org.apache.ranger.db.XXRoleRefRoleDao) XXRoleRefUser(org.apache.ranger.entity.XXRoleRefUser) XXRoleRefUserDao(org.apache.ranger.db.XXRoleRefUserDao) XXRoleRefRole(org.apache.ranger.entity.XXRoleRefRole) XXRoleRefGroup(org.apache.ranger.entity.XXRoleRefGroup) XXRoleRefGroupDao(org.apache.ranger.db.XXRoleRefGroupDao)

Example 2 with XXRoleRefRole

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

the class XXRoleRefRoleDao method getContainingRoles.

public Set<Long> getContainingRoles(Long subRoleId) {
    Set<Long> ret;
    List<XXRoleRefRole> roles = findBySubRoleId(subRoleId);
    if (CollectionUtils.isNotEmpty(roles)) {
        ret = new HashSet<>();
        for (XXRoleRefRole role : roles) {
            ret.add(role.getRoleId());
        }
    } else {
        ret = Collections.EMPTY_SET;
    }
    return ret;
}
Also used : XXRoleRefRole(org.apache.ranger.entity.XXRoleRefRole)

Aggregations

XXRoleRefRole (org.apache.ranger.entity.XXRoleRefRole)2 XXRoleRefGroupDao (org.apache.ranger.db.XXRoleRefGroupDao)1 XXRoleRefRoleDao (org.apache.ranger.db.XXRoleRefRoleDao)1 XXRoleRefUserDao (org.apache.ranger.db.XXRoleRefUserDao)1 XXRoleRefGroup (org.apache.ranger.entity.XXRoleRefGroup)1 XXRoleRefUser (org.apache.ranger.entity.XXRoleRefUser)1