Search code examples
pentahorolesmondrian

Pentaho Role Intersection


I am working with roles in mondrian schema and i would like to know if possible to make intersection of two declared roles.

I created these roles:

For product manager that has restriction on specific types of products

<Role name="product_manager">
    <SchemaGrant access="none">
      <CubeGrant cube="product" access="all">
          <HierarchyGrant hierarchy="product_group" rollupPolicy="partial" access="custom">
           <MemberGrant member="[product_group].[Wardrobes]" access="all">
           </MemberGrant>
          </HierarchyGrant>
        </CubeGrant>
    </SchemaGrant>
  </Role>

And financial manager that has restriction on specific country

<Role name="financial_manager">
        <SchemaGrant access="none">
          <CubeGrant cube="country" access="all">
              <HierarchyGrant hierarchy="country" rollupPolicy="partial" access="custom">
               <MemberGrant member="[country].[Germany]" access="all">
               </MemberGrant>
              </HierarchyGrant>
            </CubeGrant>
        </SchemaGrant>
      </Role>

My required result should be intersection of these two roles, i found that exist element UNION, but i found that it returns sum of both so the user can see all from both, it isn't my required solution.

<Role name="product_and_financial_manager_for_wardrobes_and_germany_resort">
    <Union>
        <RoleUsage roleName="product_manager" />
        <RoleUsage roleName="financial_manager" />
    </Union>
  </Role>

Something like this:

 <Role name="product_and_financial_manager_for_wardrobes_and_germany_resort">
        <Intersection>
            <RoleUsage roleName="product_manager" />
            <RoleUsage roleName="financial_manager" />
        </Intersection>
      </Role>

This is example on data:

fact_product

---------------------------------------------------------------------------
|  id_fact_product   |  price    | id_dim_product_group  | id_dim_country
---------------------------------------------------------------------------
| 1                  |   100     |   1                   |    1
---------------------------------------------------------------------------
| 2                  |    150    |   1                   |    2
---------------------------------------------------------------------------
| 3                  |    120    |   2                   |    2
---------------------------------------------------------------------------
| 4                  |    230    |   1                   |    2
---------------------------------------------------------------------------

dim_product_group

----------------------------------------------
| id_dim_product_group  |  section
----------------------------------------------
|  1                    |  Wardrobes
----------------------------------------------
|  2                    |  Tables
----------------------------------------------

dim_country

----------------------------------------------
| id_dim_country        |  country
----------------------------------------------
|  1                    |  Italy
----------------------------------------------
|  2                    |  Germany
----------------------------------------------

The result for Role product_and_financial_manager_for_wardrobes_and_germany_resort should be see data only in this range

 -----------------------------------------------------------------------------
    |  id_fact_product   |  price    | id_dim_product_group  | id_dim_country
    ---------------------------------------------------------------------------
    | 2                  |    150    |   1                   |    2
    ---------------------------------------------------------------------------
    | 4                  |    230    |   1                   |    2
    ---------------------------------------------------------------------------
----------------------------------------
    |  section           |  country  | 
    -----------------------------------
    |  Wardrobes         |  Germany  | 
    -----------------------------------
    | Wardrobes          |  Germany  | 
    -----------------------------------

Thanks for you help


Solution

  • There is no such feature in Mondrian. I suggest creating a ticket in the Jira tracker.

    Alternatively, you could implement the Role interface and pass it to your connection.