For the complete documentation index, see llms.txt. This page is also available as Markdown.

Mondrian Security

RBAC in Mondrian ..

Workshop - Mondrian Security


Overview Security Concepts

Before implementing security, it's important to understand the hierarchy of security grants in Mondrian:

Grant Type
Description

SchemaGrant

Controls access to the entire schema

CubeGrant

Controls access to individual cubes within a schema

DimensionGrant

Controls access to entire dimensions

HierarchyGrant

Controls access to hierarchies and can restrict by level (topLevel, bottomLevel)

MemberGrant

Controls access to specific members within a hierarchy


  1. Start Schema Workbench:

Windows (Powershell):

Linux:

  1. Ensure Pentaho Server is running:

Setup

Let's drill down even further ..!

The Regional Manager should only see data for the Western USA region, states that include California, Oregon, and Washington.

Users & Roles

We will create several test users to demonstrate different security scenarios:

Username
Role
Purpose

exec_user

Executive

Full access to all data

sales_mgr

Sales Manager

Access to sales cube only

region_mgr

Regional Manager

Limited to specific regions only

analyst

Analyst

Summary data only, no detailed records

  1. Log into Pentaho User Console as Administrator.

Username: admin

Password: password

  1. Navigate to Administration Perspective from the drop-down menu.

  2. Select Users & Roles > Manage Users.

  3. Click on the + sign to create each user from the table above with password: password

Add Users
  1. Navigate to Users & Roles > Manage Roles

  2. Assign the following Roles / Permissions to the User:

Role
Permissions
User

Executive

All the permissions

exec_user

Sales Manager

Schedule Content

Read Content

Publish Content

Create Content

Execute

sales_mgr

Regional Manager

Schedule Content

Read Content

Publish Content

Create Content

Execute

region_mgr

Analyst

Publish Content

Create Content

analyst

Assign Roles / Permissions to User

Role Mapper

The role mapper connects Pentaho user roles to Mondrian schema roles. We will use the Lookup Map role mapper to demonstrate flexible role mapping.

  1. Open the file - pentahoObjects.spring.xml:

  1. Locate the Mondrian-UserRoleMapper section (approximately line 295)

  2. Comment out the default One-to-One mapper if it's active:

  1. Uncomment and configure the Lookup Map role mapper:

  1. Save the file.

  2. Restart the Pentaho server for changes to take effect.

Linux:

The key represents the Pentaho role name, and the value represents the Mondrian role name that will be defined in the schema.

SchemaGrant

SchemaGrant controls access to the Miniature Models schema. We'll implement two scenarios:

full access:

no access:

Refresh the Mondrian Schema Cache

  1. Log in as Administrator.

Password: password

Refresh the Mondrian Cache

Follow the steps below to understand the difference bewteen Full & No access:

Full Access - Executive Role

The Executive role should have unrestricted access to all cubes and dimensions in the schema. The easiest method to apply the SchemaGrant is by editing

  1. Open the Miniature Models - original.xml schema.

  2. Save as: Miniature Models - security.

Miniature Models -security.xml
  1. Highlight Schema and Click on the 'User shadow+'.

  2. Enter: Executive Role & tab to set the value.

  3. Right-mouse on Executive Role & Select: Add Schema Grant:

Set Executive Role
  1. Select: all & tab to set the value:

Schema Grant access = all
  1. Right-mouse click on the Schema Grant and Add Cube Grant:

Add Cube Grant
  1. Set access: all

  2. From the cube drop-down, select: Sales_FY2003_2005:

Cube Grant to Sales_FY2003_2005 cube only
  1. Click Save & Publish.

Currently only Executive Role users have access to the Miniature Models - security schema / Sales_FY2003_2005 cube as a data source ..

To test login as: exec_user

Executive Role Data Sources

To test log in as: analyst

Analyst Data Sources - no Miniature Models..!

Sales Manager

So far only the Executive Role users have access to the Miniature Models - security schema as a data source. Next step is to set access to the Sales_FY2003_2005 cube only for the Sales Managers Role users.

  1. Open the Miniature Models - security.xml schema.

  2. Highlight Schema and Click on the 'User shadow+'.

  3. Enter: Sales Managers Role & tab to set the value.

  4. Right-mouse on Sales Managers Role & Select: Add Schema Grant.

  5. Select: none & tab to set the value:

Schema Grant access = none
  1. Right-mouse click on the Schema Grant and Add Cube Grant.

  2. Set the access: all & tab to set the value.

  3. From the cube drop-down, select cube: Sales_FY2003_2005 & tab.

  1. Click Save & Publish.

  2. To test login in as: sales_mgr

sales_mgr

Setting access='none' at the SchemaGrant level blocks all cubes by default. The CubeGrant then selectively grants access to the Sales_FY2003_2005 cube, implicitly granting access to the parent schema as well.

Remember to refresh the Mondrian Schema Cache ..

HierarchyGrant

HierarchyGrant allows fine-grained control over which levels of a hierarchy users can access. We'll use topLevel and bottomLevel attributes to restrict the Analyst role's view.

The Analyst role should see summarized data only, without access to the most granular details. We'll restrict their view to show data from Country level down to City level, but not individual PostalCodes.

So were going to have to add some Levels to our Schema:

All > Territory > Country > State > City > Customer Name

Refresh the Mondrian Schema Cache

  1. Log in as Administrator.

Password: password

Refresh the Mondrian Cache

  1. To add another level, in the left pane, right-click the Customers (hierarchy) under CUSTOMERS and select Add Level.

  2. To define the State level, type or choose:

Attribute
Value

name

State

column

STATE

type

String

levelType

Regular

hideMemberIf

Never

  1. To define the City level, type or choose:

Attribute
value

name

City

column

CITY

type

String

levelType

Regular

hideMemberIf

Never


  1. Open the Miniature Models - security.xml schema.

  2. Highlight Schema and Click on the 'User shadow+'.

  3. Enter: Analyst Role & tab to set the value.

  4. Right-mouse on Analyst Role & Select: Add Schema Grant.

  5. Select: none & tab to set the value:

  6. Right-mouse click on the Schema Grant and Add Cube Grant.

  7. Set the access: all & tab to set the value.

  8. From the cube drop-down, select cube: Sales_FY2003_2005 & tab.

  9. Right-mouse click on the Cube Grant and Add Hierarchy Grant.

Add Hierarchy Grant - CUSTOMERS.Customers
  1. From the drop-down options select the following:

Attribute
Value

access

custom

hierarchy

[CUSTOMERS.Customers]

topLevel

[CUSTOMERS.Customers].[Country]

bottomLevel

[CUSTOMERS.Customers].[City]

Set hierarchy [CUSTOMERS.Customers] topLevel & bottomLevel

Top & Bottom Level

  • topLevel: The highest (most aggregated) level the user can see. Setting it to Country means the user cannot see the All level.

  • bottomLevel: The lowest (most detailed) level the user can see. Setting it to City means the user cannot see individual Store data.

Result: The Analyst can see data aggregated from Country > Region > City, but not Customer Name -level details.

  1. Right-mouse click on the Cube Grant and Add Hierarchy Grant.

  2. From the drop-down options select the following:

Attribute
Value

access

all

hierarchy

[PRODUCTS.Products]

Set hierarchy [PRODUCTS.Products]
  1. Click Save & Publish.


To test login in as: analyst

Analyst

Notice: The scope of the Customers Hierarchy has been restricted - no Territory & PostalCode

Member Grant

Let's dive a bit deeper..!

The Regional Manager Role should only see data for the Eastern USA region, which include: New York, New Jersey, and Pennsylvania.

Refresh the Mondrian Schema Cache

  1. Log in as Administrator.

Password: password

Refresh the Mondrian Cache

  1. Open the Miniature Models - security.xml schema.

  2. Highlight Schema and Click on the 'User shadow+'.

  3. Enter: Regional Manager Role & tab to set the value.

  4. Right-mouse on Regional Manager Role & Select: Add Schema Grant.

  5. Select: none & tab to set the value:

  6. Right-mouse click on the Schema Grant and Add Cube Grant.

  7. Set the access: all & tab to set the value.

  8. From the cube drop-down, select cube: Sales_FY2003_2005 & tab.

  9. Right-mouse click on the Cube Grant and Add Hierarchy Grant.

  10. From the drop-down options select the following:

Attribute
Value

access

custom

hierarchy

[CUSTOMERS.Customers]

topLevel

[CUSTOMERS.Customers].[State]

Set hierarchy [CUSTOMERS.Customers] topLevel
  1. Right-mouse click on Hierarchy Grant to Add a Member Grant.

Add the Member constraints for each State: [NJ] [NY] [PA]

  1. Repeat the workflow to add the following Member Grants:

Attribute
Value

access

all

member

[CUSTOMERS.Customers].[NA].[USA].[NJ]

[CUSTOMERS.Customers].[NA].[USA].[NY]

[CUSTOMERS.Customers].[NA].[USA].[PA]

Set member [CUSTOMERS.Customers].[NA].[USA].[NJ]
  1. Finally add the PRODUCTS.Products hierarchy:

Attribute
Value

access

all

hierarchy

{PRODUCTS.Products]

Set hierarchy [PRODUCTS.Products]
  1. Finally Save & Publish.

With access="custom", Mondrian denies everything by default and only allows what you explicitly grant. By only granting access to NJ, NY, and PA, those are the only states that will be visible.


To test login in as: region_mgr

Notice topLevel: STATE. The default behaviour is to restrict the total / SUM as a Partial rollup.

Rollup Policies

Rollup policies control how measures are aggregated when role-based security restricts access to certain members in a dimension hierarchy. This becomes critical when you have hierarchies with restricted access - topLevel & bottomLevel will restrict the aggregation.

When a role restricts access to certain dimension members, what should happen to the totals at higher levels? Should they be included the restricted data or not?

Policy
Behaviour

full

Shows the complete total including hidden members. User sees accurate company-wide totals but cannot infer hidden values if few members are visible.

partial

Shows total of only visible members. User sees accurate subtotals for their authorized data. Useful when users should only see their scope.

hidden

Hides the total completely if any children are not accessible. Most restrictive option, prevents any inference of hidden data.

Role Type
Recommended Policy
Reason

Executive / VP

full

Need complete picture, restricted drill-down

Regional Manager

partial

Should only see their region's totals

Contributor

partial or hidden

Limited scope, no need for aggregates

Analyst (restricted data)

full

Need context of full data while working with subset

Remember the aggregation level is determined by the access restrictions. So .. If Regional Manager needs to see "complete totals but limited drill-down":

Use top-down grant with denials:

Was this helpful?