Set env::username for testing PRPT in Pentaho Report Designer (PRD)

by Andrew Cave
July 23, 2019
A common technique to restrict access in Pentaho Report Designer is use the variable ‘${env::username}’ in queries. This is replaced with the currently logged in username on the server and allows group memberships/rows access to be identified at the database level.

Unfortunately, when testing (or debugging) a report using the Desktop designer, there is no obvious way to set the username – this means all the queries have to be manually changed to use a string literal (e.g. ‘acave’) with all the risks that might entail.

However, a tip I discovered on an obscure forum from more than a decade ago , allows the setting of the username value at program startup.

In the file

[PRD_INSTALL_PATH]/report-designer/resources/classic-engine.properties

(on my Win10 setup, it’s in C:\pentaho\design-tools\report-designer\resources\classic-engine.properties)

Find the line

org.pentaho.reporting.engine.classic.core.environment.username=Designer

and change it to (your user for testing). Here I’m using ‘test_user_name’

org.pentaho.reporting.engine.classic.core.environment.username=test_user_name

Save the file and restart the Pentaho Report Designer. When running your queries, the ‘${env::username}’ will be replaced with ‘test_user_name’ when the queries are run.

Other blog post

Data Engineering and Infrastructure

This week we continue our exploration of The BizCubed Method and the Data Maturity Model. See this post for an overview of the model and this post for a deep dive on Security. This week we tackle...

read more

Data Security as a Practice

At BizCubed, we approach security not as an achievable end-state, but as a daily practice. We intentionally build security into every aspect of our operation. In our view, this is how we get better – we teach and learn, all in an effort to Make Better Decisions Each Day.

read more