Package org.pentaho.platform.security.userroledao.service

Examples of org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService


    systemRoles.add( "Admin" );
    List<String> extraRoles = Arrays.asList( new String[]{"Authenticated", "Anonymous"} );
    String adminRole = "Admin";

    userRoleListService =
        new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, tenantedUserNameUtils, systemRoles,
            extraRoles, adminRole );
    ( (UserRoleDaoUserRoleListService) userRoleListService ).setUserRoleDao( userRoleDao );
    ( (UserRoleDaoUserRoleListService) userRoleListService ).setUserDetailsService( userDetailsService );

    mp.defineInstance( IUserRoleListService.class, userRoleListService );
View Full Code Here


    List<String> systemRoles = new ArrayList<String>();
    systemRoles.add( "Administrator" );
    List<String> extraRoles = Arrays.asList( new String[]{"Authenticated", "Anonymous"} );
    String adminRole = "Admin";
    userRoleListService =
        new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, tenantedUserNameUtils, systemRoles,
            extraRoles, adminRole );
    ( (UserRoleDaoUserRoleListService) userRoleListService ).setUserRoleDao( userRoleDao );
    ( (UserRoleDaoUserRoleListService) userRoleListService ).setUserDetailsService( userDetailsService );
    mp.defineInstance( IUserRoleListService.class, userRoleListService );
    mp.start();
View Full Code Here

    List<String> systemRoles = Arrays.asList( USERNAME_ADMIN );
    List<String> extraRoles = Arrays.asList( AUTHENTICATED_ROLE_NAME, ANONYMOUS_ROLE_NAME );
    String adminRole = USERNAME_ADMIN;

    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    UserRoleDaoUserRoleListService service =
      new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, userNameUtils, systemRoles,
        extraRoles, adminRole );
    userDetailsService.setUserRoleDao( userRoleDao );
    logout();
    login( USERNAME_ADMIN, mainTenant_1, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );

    List<String> allRolesForDefaultTenant = service.getAllRoles();
    List<String> allRolesForTenant = service.getAllRoles( mainTenant_2 );
    logger.info( "allRolesForDefaultTenant.size() ==" + allRolesForDefaultTenant.size() );
    logger.info( "allRolesForTenant.size() ==" + allRolesForTenant.size() );


    assertTrue( allRolesForDefaultTenant.size() == 2 + DEFAULT_ROLE_COUNT );
    assertEquals( 3 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    logout();
    login( USERNAME_ADMIN, mainTenant_2, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );
    allRolesForDefaultTenant = service.getAllRoles();
    allRolesForTenant = service.getAllRoles( mainTenant_1 );
    assertTrue( allRolesForDefaultTenant.size() == 3 + DEFAULT_ROLE_COUNT );
    assertEquals( 2 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    allRolesForTenant = service.getAllRoles( mainTenant_2 );
    assertEquals( 3 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    allRolesForTenant = service.getAllRoles( mainTenant_1 );
    assertEquals( 2 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    logout();
    login( USERNAME_ADMIN, mainTenant_1, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );

    allRolesForTenant = service.getAllRoles( mainTenant_1 );
    assertEquals( 2 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    allRolesForTenant = service.getAllRoles( mainTenant_2 );
    assertEquals( 3 + DEFAULT_ROLE_COUNT, allRolesForTenant.size() );

    cleanupUserAndRoles( mainTenant_1 );
    cleanupUserAndRoles( mainTenant_2 );
  }
View Full Code Here

    List<String> systemRoles = Arrays.asList( USERNAME_ADMIN );
    List<String> extraRoles = Arrays.asList( AUTHENTICATED_ROLE_NAME, ANONYMOUS_ROLE_NAME );
    String adminRole = USERNAME_ADMIN;

    UserRoleDaoUserRoleListService service =
      new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, userNameUtils, systemRoles,
        extraRoles, adminRole );
    service.setUserRoleDao( userRoleDao );
    service.setUserDetailsService( userDetailsService );

    logout();
    login( USERNAME_ADMIN, mainTenant_1, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );
    List<String> allUserForDefaultTenant = service.getAllUsers();
    List<String> allUserForTenant = service.getAllUsers( mainTenant_2 );

    assertEquals( 5 + DEFAULT_USER_COUNT, allUserForDefaultTenant.size() );
    assertEquals( 2 + DEFAULT_USER_COUNT, allUserForTenant.size() );
    logout();
    login( USERNAME_ADMIN, mainTenant_2, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );
    allUserForDefaultTenant = service.getAllUsers();
    allUserForTenant = service.getAllUsers( mainTenant_1 );

    assertTrue( allUserForDefaultTenant.size() == 2 + DEFAULT_USER_COUNT );
    assertEquals( 5 + DEFAULT_USER_COUNT, allUserForTenant.size() );

    allUserForTenant = service.getAllUsers( mainTenant_1 );

    assertEquals( 5 + DEFAULT_USER_COUNT, allUserForTenant.size() );
    allUserForTenant = service.getAllUsers( mainTenant_2 );
    assertEquals( 2 + DEFAULT_USER_COUNT, allUserForTenant.size() );
    logout();

    login( USERNAME_ADMIN, mainTenant_1, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );
    allUserForTenant = service.getAllUsers( mainTenant_1 );
    assertEquals( 5 + DEFAULT_USER_COUNT, allUserForTenant.size() );

    allUserForTenant = service.getAllUsers( mainTenant_2 );
    assertEquals( 2 + DEFAULT_USER_COUNT, allUserForTenant.size() );

    cleanupUserAndRoles( mainTenant_1 );
    cleanupUserAndRoles( mainTenant_2 );
  }
View Full Code Here

    userDetailsService.setDefaultRole( tenantAuthenticatedRoleName );

    List<String> extraRoles = Arrays.asList( AUTHENTICATED_ROLE_NAME, ANONYMOUS_ROLE_NAME );
    String adminRole = USERNAME_ADMIN;

    UserRoleDaoUserRoleListService service =
      new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, userNameUtils, systemRoles,
        extraRoles, adminRole );
    service.setUserDetailsService( userDetailsService );

    logout();
    login( USERNAME_ADMIN, mainTenant_1, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );
    List<String> rolesForUser_2 = service.getRolesForUser( mainTenant_1, USER_2 );
    List<String> rolesForUser_2_1 = service.getRolesForUser( null, USER_2 );
    List<String> rolesForUser_2_1_1 =
      service.getRolesForUser( null, userNameUtils.getPrincipleId( mainTenant_1, USER_2 ) );
    List<String> rolesForUser_3 = service.getRolesForUser( mainTenant_1, USER_3 );
    List<String> rolesForUser_4 = service.getRolesForUser( mainTenant_1, USER_4 );

    assertTrue( rolesForUser_2.size() == 4 );
    assertTrue( rolesForUser_2_1.size() == 4 );
    assertTrue( rolesForUser_2_1_1.size() == 4 );
    assertTrue( rolesForUser_3.size() == 3 );
View Full Code Here

    systemRoles.add( USERNAME_ADMIN );

    List<String> extraRoles = Arrays.asList( AUTHENTICATED_ROLE_NAME, ANONYMOUS_ROLE_NAME );
    String adminRole = USERNAME_ADMIN;

    UserRoleDaoUserRoleListService service =
      new UserRoleDaoUserRoleListService( userRoleDao, userDetailsService, userNameUtils, systemRoles,
        extraRoles, adminRole );

    List<String> usersInRole_1 = service.getUsersInRole( mainTenant_1, ROLE_1 );
    List<String> usersInRole_2 = service.getUsersInRole( null, ROLE_2 );
    List<String> usersInRole_3 =
      service.getUsersInRole( null, roleNameUtils.getPrincipleId( mainTenant_1, ROLE_3 ) );

    logout();
    login( USERNAME_ADMIN, mainTenant_2, new String[]{ tenantAdminRoleName, tenantAuthenticatedRoleName } );

    List<String> usersInRole_4 = service.getUsersInRole( mainTenant_2, ROLE_4 );

    assertTrue( usersInRole_1.size() == 3 );
    assertTrue( usersInRole_2.size() == 2 );
    assertTrue( usersInRole_3.size() == 3 );
    assertTrue( usersInRole_4.size() == 1 );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService

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.