// What we do here is to filter the role names with the mapper.
// First, get a user role mapper, if one is configured.
final IPentahoSession session =
PentahoSessionHolder.getSession();
final IConnectionUserRoleMapper mondrianUserRoleMapper =
PentahoSystem.get(
IConnectionUserRoleMapper.class,
MDXConnection.MDX_CONNECTION_MAPPER_KEY,
null ); // Don't use the user session here yet.
String[] effectiveRoles = new String[0];
/*
* If Catalog/Schema are null (this happens with high level metadata requests,
* like DISCOVER_DATASOURCES) we can't use the role mapper, even if it
* is present and configured.
*/
if ( mondrianUserRoleMapper != null
&& catalogName != null ) {
// Use the role mapper.
try {
effectiveRoles =
mondrianUserRoleMapper
.mapConnectionRoles(
session,
catalogName );
if ( effectiveRoles == null ) {
effectiveRoles = new String[0];