tenantManager.createTenant( mainTenant_2, SUB_TENANT2_2, adminRoleName, authenticatedRoleName, "Anonymous" );
userRoleDaoProxy.createUser( subTenant2_2, "admin", "password", "", new String[]{adminRoleName} );
login( "admin", mainTenant_1, new String[]{adminRoleName, authenticatedRoleName} );
List<IPentahoUser> users = userRoleDaoProxy.getUsers( mainTenant_1 );
IPentahoUser pentahoUser = userRoleDaoProxy.createUser( mainTenant_1, USER_2,
PASSWORD_2, USER_DESCRIPTION_2, null );
pentahoUser = userRoleDaoProxy.getUser( mainTenant_1, USER_2 );
assertEquals( pentahoUser.getTenant(), mainTenant_1 );
assertEquals( pentahoUser.getUsername(), USER_2 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_2 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
/*login( "admin", subTenant2_1, new String[] { adminRoleName, authenticatedRoleName } );
try {
pentahoUser = userRoleDaoProxy.createUser( mainTenant_1, USER_2, PASSWORD_2,
USER_DESCRIPTION_2, null );
fail( "Exception not thrown" );
} catch ( Throwable th ) {
assertNotNull( th );
}
logout();*/
login( "admin", mainTenant_1, new String[]{adminRoleName, authenticatedRoleName} );
users = userRoleDaoProxy.getUsers( mainTenant_1 );
int DEFAULT_USER_COUNT = 1;
assertTrue( users.size() == 1 + DEFAULT_USER_COUNT );
boolean foundUser = false;
for ( IPentahoUser user : users ) {
if ( user.getUsername().equals( USER_2 ) ) {
foundUser = true;
pentahoUser = user;
break;
}
}
assertTrue( foundUser );
assertEquals( pentahoUser.getTenant(), mainTenant_1 );
assertEquals( pentahoUser.getUsername(), USER_2 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_2 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", mainTenant_2, new String[]{adminRoleName, authenticatedRoleName} );
pentahoUser = userRoleDaoProxy.createUser( mainTenant_2, USER_2, PASSWORD_2, USER_DESCRIPTION_2, null );
logout();
login( "admin", subTenant1_1, new String[]{adminRoleName, authenticatedRoleName} );
try {
pentahoUser = userRoleDaoProxy.createUser( mainTenant_2, USER_2, PASSWORD_2, USER_DESCRIPTION_2, null );
fail( "Exception not thrown" );
} catch ( Throwable th ) {
assertNotNull( th );
}
logout();
login( "admin", mainTenant_2, new String[]{adminRoleName, authenticatedRoleName} );
pentahoUser = userRoleDaoProxy.getUser( mainTenant_2, USER_2 );
assertEquals( pentahoUser.getTenant(), mainTenant_2 );
assertEquals( pentahoUser.getUsername(), USER_2 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_2 );
assertEquals( pentahoUser.isEnabled(), true );
users = userRoleDaoProxy.getUsers( mainTenant_2 );
assertTrue( users.size() == 1 + DEFAULT_USER_COUNT );
foundUser = false;
for ( IPentahoUser user : users ) {
if ( user.getUsername().equals( USER_2 ) ) {
foundUser = true;
pentahoUser = user;
break;
}
}
assertTrue( foundUser );
assertEquals( pentahoUser.getTenant(), mainTenant_2 );
assertEquals( pentahoUser.getUsername(), USER_2 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_2 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", subTenant2_1, new String[]{adminRoleName, authenticatedRoleName} );
pentahoUser =
userRoleDaoProxy.createUser( null, USER_3 + DefaultTenantedPrincipleNameResolver.DEFAULT_DELIMETER
+ subTenant2_1.getRootFolderAbsolutePath(), PASSWORD_3, USER_DESCRIPTION_3, null );
pentahoUser =
userRoleDaoProxy.getUser( null, USER_3 + DefaultTenantedPrincipleNameResolver.DEFAULT_DELIMETER
+ subTenant2_1.getRootFolderAbsolutePath() );
assertEquals( pentahoUser.getTenant(), subTenant2_1 );
assertEquals( pentahoUser.getUsername(), USER_3 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_3 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", subTenant1_1, new String[]{adminRoleName, authenticatedRoleName} );
try {
pentahoUser = userRoleDaoProxy.createUser( subTenant2_1, USER_1, PASSWORD_1, USER_DESCRIPTION_1, null );
fail( "Exception not thrown" );
} catch ( Throwable th ) {
assertNotNull( th );
}
logout();
login( "admin", subTenant2_1, new String[]{adminRoleName, authenticatedRoleName} );
users = userRoleDaoProxy.getUsers( subTenant2_1 );
assertTrue( users.size() == 1 + DEFAULT_USER_COUNT );
foundUser = false;
for ( IPentahoUser user : users ) {
if ( user.getUsername().equals( USER_3 ) ) {
foundUser = true;
pentahoUser = user;
break;
}
}
assertTrue( foundUser );
assertEquals( pentahoUser.getTenant(), subTenant2_1 );
assertEquals( pentahoUser.getUsername(), USER_3 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_3 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", subTenant1_1, new String[]{adminRoleName, authenticatedRoleName} );
pentahoUser =
userRoleDaoProxy.createUser( null, USER_4 + DefaultTenantedPrincipleNameResolver.DEFAULT_DELIMETER
+ subTenant1_1.getRootFolderAbsolutePath(), PASSWORD_4, USER_DESCRIPTION_4, null );
pentahoUser =
userRoleDaoProxy.getUser( null, USER_4 + DefaultTenantedPrincipleNameResolver.DEFAULT_DELIMETER
+ subTenant1_1.getRootFolderAbsolutePath() );
assertEquals( pentahoUser.getTenant(), subTenant1_1 );
assertEquals( pentahoUser.getUsername(), USER_4 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_4 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", subTenant2_1, new String[]{adminRoleName, authenticatedRoleName} );
try {
pentahoUser = userRoleDaoProxy.createUser( subTenant1_1, USER_1, PASSWORD_1, USER_DESCRIPTION_1, null );
fail( "Exception not thrown" );
} catch ( Throwable th ) {
assertNotNull( th );
}
logout();
login( "admin", subTenant1_1, new String[]{adminRoleName, authenticatedRoleName} );
users = userRoleDaoProxy.getUsers( subTenant1_1 );
assertTrue( users.size() == 1 + DEFAULT_USER_COUNT );
foundUser = false;
for ( IPentahoUser user : users ) {
if ( user.getUsername().equals( USER_4 ) ) {
foundUser = true;
pentahoUser = user;
break;
}
}
assertTrue( foundUser );
assertEquals( pentahoUser.getTenant(), subTenant1_1 );
assertEquals( pentahoUser.getUsername(), USER_4 );
assertEquals( pentahoUser.getDescription(), USER_DESCRIPTION_4 );
assertEquals( pentahoUser.isEnabled(), true );
logout();
login( "admin", mainTenant_1, new String[]{adminRoleName, authenticatedRoleName} );
try {