Search in sources :

Example 1 with RolapCubeDimension

use of mondrian.rolap.RolapCubeDimension in project mondrian by pentaho.

the class RoleImpl method checkDimensionAccessByCubeInheritance.

/**
 * This method is used to check if the access rights over a dimension
 * that might be inherited from the parent cube.
 * <p>It only checks for inherited access, and it presumes that there
 * are no dimension grants currently given to the dimension passed as an
 * argument.
 */
private Access checkDimensionAccessByCubeInheritance(Dimension dimension) {
    assert dimensionGrants.containsKey(dimension) == false || dimension.isMeasures();
    for (Map.Entry<Cube, Access> cubeGrant : cubeGrants.entrySet()) {
        final Access access = toAccess(cubeGrant.getValue());
        // The 'none' and 'custom' access level are not good enough
        if (access == Access.NONE || access == Access.CUSTOM) {
            continue;
        }
        final Dimension[] dimensions = cubeGrant.getKey().getDimensions();
        for (Dimension dimension1 : dimensions) {
            // we found an access rule.
            if (dimension == dimension1) {
                return cubeGrant.getValue();
            }
            // If not, skip to the next grant.
            if (dimension instanceof RolapCubeDimension && dimension.equals(dimension1) && !((RolapCubeDimension) dimension1).getCube().equals(cubeGrant.getKey())) {
                continue;
            }
            // to work with virtual cubes.
            if (cubeGrant.getKey() instanceof RolapCube && ((RolapCube) cubeGrant.getKey()).isVirtual() && dimension.equals(dimension1)) {
                return cubeGrant.getValue();
            }
        }
    }
    return Access.NONE;
}
Also used : RolapCube(mondrian.rolap.RolapCube) RolapCubeDimension(mondrian.rolap.RolapCubeDimension) RolapCubeDimension(mondrian.rolap.RolapCubeDimension) RolapCube(mondrian.rolap.RolapCube)

Aggregations

RolapCube (mondrian.rolap.RolapCube)1 RolapCubeDimension (mondrian.rolap.RolapCubeDimension)1