Package org.pentaho.platform.plugin.action.mondrian.mapper

Examples of org.pentaho.platform.plugin.action.mondrian.mapper.MondrianLookupMapUserRoleListMapper


    Map<String, String> lookup = new HashMap<String, String>();
    lookup.put( "ceo", "Role1" );
    lookup.put( "Not Pentaho", "Role2" );
    lookup.put( "Not Mondrian or Pentaho", "Role3" );

    final MondrianLookupMapUserRoleListMapper mapper = new MondrianLookupMapUserRoleListMapper();
    mapper.setLookupMap( lookup );

    try {
      String[] roles = SecurityHelper.getInstance().runAsUser( "admin", new Callable<String[]>() {
        @Override
        public String[] call() throws Exception {
          return mapper.mapConnectionRoles( PentahoSessionHolder.getSession(), "SteelWheelsRoles" );
        }
      } );
      Assert.assertNotNull( roles );
      Assert.assertEquals( 1, roles.length );
      Assert.assertEquals( "Role1", roles[0] );
View Full Code Here


  public void testNoMatchLookupMapUserRoleListMapper() throws Exception {
    Map<String, String> lookup = new HashMap<String, String>();
    lookup.put( "No Match", "Role1" );
    lookup.put( "No Match Here Either", "Role2" );

    final MondrianLookupMapUserRoleListMapper mapper = new MondrianLookupMapUserRoleListMapper();
    mapper.setLookupMap( lookup );

    mapper.setFailOnEmptyRoleList( true );
    try {
      SecurityHelper.getInstance().runAsUser( "admin", new Callable<String[]>() {
        @Override
        public String[] call() throws Exception {
          return mapper.mapConnectionRoles( PentahoSessionHolder.getSession(), "SteelWheelsRoles" );
        }
      } );
      Assert.fail();
    } catch ( PentahoAccessControlException e ) {
      // no op.
    }

    mapper.setFailOnEmptyRoleList( false );

    try {
      String[] roles = SecurityHelper.getInstance().runAsUser( "admin", new Callable<String[]>() {
        @Override
        public String[] call() throws Exception {
          return mapper.mapConnectionRoles( PentahoSessionHolder.getSession(), "SteelWheelsRoles" );
        }
      } );
      Assert.assertNull( roles );
    } catch ( PentahoAccessControlException e ) {
      Assert.fail( e.getMessage() );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.plugin.action.mondrian.mapper.MondrianLookupMapUserRoleListMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.