PentahoMondrianConnectionProvider extends DefaultMondrianConnectionProvider { public Object getConnectionHash( final Properties properties ) throws ReportDataFactoryException { try { final IPentahoSession session = PentahoSessionHolder.getSession(); final String name = session.getName(); return SecurityHelper.getInstance().runAsUser( name, () -> { final ArrayList<Object> hash = (ArrayList<Object>) super.getConnectionHash( properties ); final String catalog = properties.getProperty( "Catalog" ); hash.add( computeRoleString( catalog ) ); return hash; } ); } catch ( Exception e ) { throw new ReportDataFactoryException( "Failed to map roles", e ); } } PentahoMondrianConnectionProvider(); Connection createConnection( final Properties properties, final DataSource dataSource ); Object getConnectionHash( final Properties properties ); static final String MDX_CONNECTION_MAPPER_KEY; }
@Test public void testGetConnectionHash() throws Exception { ArrayList result = (ArrayList) provider.getConnectionHash( mock( Properties.class ) ); assertEquals( 3, result.size() ); assertEquals( "org.pentaho.reporting.platform.plugin.connection.PentahoMondrianConnectionProvider", result.get( 0 ) ); }