Package org.pentaho.platform.plugin.services.security.userrole.ldap

Examples of org.pentaho.platform.plugin.services.security.userrole.ldap.DefaultLdapUserRoleListService


    RolePreprocessingMapper mapper = new RolePreprocessingMapper();
    mapper.setRoleAttributes( new String[] { "uniqueMember" } ); //$NON-NLS-1$
    mapper.setTokenName( "cn" ); //$NON-NLS-1$
    service.setUserDetailsMapper( mapper );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setUserDetailsService( service );

    List res = userRoleListService.getRolesForUser( null, "suzy" ); //$NON-NLS-1$

    assertTrue( res.contains( "ROLE_A" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAuthoritiesForUser1(): " + res ); //$NON-NLS-1$
View Full Code Here


    RolePreprocessingMapper mapper = new RolePreprocessingMapper();
    mapper.setRoleAttributes( new String[] { "uniqueMember" } ); //$NON-NLS-1$
    mapper.setTokenName( "cn" ); //$NON-NLS-1$
    service.setUserDetailsMapper( mapper );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setUserDetailsService( service );

    List res = userRoleListService.getRolesForUser( defaultTenant, "suzy" ); //$NON-NLS-1$

    assertTrue( res.contains( "ROLE_A" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAuthoritiesForUser1(): " + res ); //$NON-NLS-1$
    }

    try {
      userRoleListService.getRolesForUser( new Tenant( "/pentaho", true ), "suzy" );
    } catch ( UnsupportedOperationException uoe ) {
      assertNotNull( uoe );
    }

  }
View Full Code Here

    LdapUserSearch userSearch = getUserSearch( "ou=users", "(uid={0})" ); //$NON-NLS-1$//$NON-NLS-2$

    LdapUserDetailsService service = new LdapUserDetailsService( userSearch, populator );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setUserDetailsService( service );

    List res = userRoleListService.getRolesForUser( null, "suzy" ); //$NON-NLS-1$
    assertTrue( res.contains( "ROLE_IS" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAuthoritiesForUser2(): " + res ); //$NON-NLS-1$
    }
View Full Code Here

    LdapUserSearch userSearch = getUserSearch( "ou=users", "(uid={0})" ); //$NON-NLS-1$//$NON-NLS-2$

    LdapUserDetailsService service = new LdapUserDetailsService( userSearch, populator );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setUserDetailsService( service );
    userRoleListService.setRoleComparator( new DefaultRoleComparator() );

    List res = userRoleListService.getRolesForUser( null, "suzy" ); //$NON-NLS-1$
    assertTrue( res.contains( "ROLE_POWER_USER" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAuthoritiesForUser2Sorted(): " + res ); //$NON-NLS-1$
    }
View Full Code Here

    Transformer transformer1 = new SearchResultToAttrValueList( "uniqueMember", "uid" ); //$NON-NLS-1$ //$NON-NLS-2$

    GenericLdapSearch allUsernamesSearch = new GenericLdapSearch( getContextSource(), paramFactory, transformer1 );
    allUsernamesSearch.afterPropertiesSet();

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setAllUsernamesSearch( allUsernamesSearch );

    List res = userRoleListService.getAllUsers();

    assertTrue( res.contains( "pat" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "admin" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
View Full Code Here

    Transformer transformer1 = new SearchResultToAttrValueList( "uniqueMember", "uid" ); //$NON-NLS-1$ //$NON-NLS-2$

    GenericLdapSearch allUsernamesSearch = new GenericLdapSearch( getContextSource(), paramFactory, transformer1 );
    allUsernamesSearch.afterPropertiesSet();

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setAllUsernamesSearch( allUsernamesSearch );

    List res = userRoleListService.getAllUsers( defaultTenant );

    assertTrue( res.contains( "pat" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "admin" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAllUserNames1(): " + res ); //$NON-NLS-1$
    }

    try {
      userRoleListService.getAllUsers( new Tenant( "/pentaho", true ) );
    } catch ( UnsupportedOperationException uoe ) {
      assertNotNull( uoe );
    }

  }
View Full Code Here

    Transformer transformer1 = new SearchResultToAttrValueList( "uniqueMember", "uid" ); //$NON-NLS-1$ //$NON-NLS-2$

    GenericLdapSearch allUsernamesSearch = new GenericLdapSearch( getContextSource(), paramFactory, transformer1 );
    allUsernamesSearch.afterPropertiesSet();

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setAllUsernamesSearch( allUsernamesSearch );
    userRoleListService.setUsernameComparator( new DefaultUsernameComparator() );

    List res = userRoleListService.getAllUsers();

    assertTrue( res.indexOf( "pat" ) < res.indexOf( "tiffany" ) );

    if ( logger.isDebugEnabled() ) {
      logger.debug( "results of getAllUserNames1Sorted(): " + res ); //$NON-NLS-1$
View Full Code Here

    Transformer transformer2 = new SearchResultToAttrValueList( "uid" ); //$NON-NLS-1$

    LdapSearch allUsernamesSearch = new GenericLdapSearch( getContextSource(), paramsFactory, transformer2 );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setAllUsernamesSearch( allUsernamesSearch );

    List res = userRoleListService.getAllUsers();

    assertTrue( res.contains( "pat" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "admin" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
View Full Code Here

    Transformer transformer3 = new SearchResultToAttrValueList( "roleOccupant", "uid" ); //$NON-NLS-1$ //$NON-NLS-2$

    LdapSearch allUsernamesSearch = new GenericLdapSearch( getContextSource(), paramsFactory, transformer3 );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setAllUsernamesSearch( allUsernamesSearch );

    List res = userRoleListService.getAllUsers();

    assertTrue( res.contains( "pat" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "tiffany" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "admin" ) ); //$NON-NLS-1$
View Full Code Here

    GrantedAuthorityToString transformer2 = new GrantedAuthorityToString();

    LdapSearch usernamesInRoleSearch =
        new GenericLdapSearch( getContextSource(), paramFactory, transformer1, transformer2 );

    DefaultLdapUserRoleListService userRoleListService = new DefaultLdapUserRoleListService();

    userRoleListService.setUsernamesInRoleSearch( usernamesInRoleSearch );

    List<String> res = userRoleListService.getUsersInRole( null, "DEV" ); //$NON-NLS-1$

    assertTrue( res.contains( "pat" ) ); //$NON-NLS-1$
    assertTrue( res.contains( "tiffany" ) ); //$NON-NLS-1$

    if ( logger.isDebugEnabled() ) {
View Full Code Here

TOP

Related Classes of org.pentaho.platform.plugin.services.security.userrole.ldap.DefaultLdapUserRoleListService

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.