Exemple #1
0
 @AfterClass(alwaysRun = true)
 public void cleanup() throws Exception {
   adminUserManagementClient.deleteRole(ROLE_NAME);
   adminUserManagementClient.updateUserListOfRole(EXISTING_ROLE, ROLE_USERS, new String[] {});
   if (adminUserManagementClient.roleNameExists(NEW_ROLE)) {
     adminUserManagementClient.deleteRole(NEW_ROLE);
   }
   FlaggedName[] flaggedNames = adminUserManagementClient.getRolesOfUser(NEW_USER, "*", 100);
   for (FlaggedName name : flaggedNames) {
     if (name.getItemName().equals(PermissionTestConstants.EVERYONE_ROLE)) {
       adminUserManagementClient.deleteUser(NEW_USER);
     }
   }
   adminUserManagementClient = null;
   user1UserManagementClient = null;
 }
Exemple #2
0
  @BeforeClass(alwaysRun = true)
  public void init() throws Exception {
    int userId = 1;
    UserInfo userInfo = UserListCsvReader.getUserInfo(userId);
    EnvironmentBuilder builderAdmin = new EnvironmentBuilder().greg(ProductConstant.ADMIN_USER_ID);
    ManageEnvironment adminEnvironment = builderAdmin.build();

    EnvironmentBuilder builderUser1 = new EnvironmentBuilder().greg(userId);
    ManageEnvironment user1Environment = builderUser1.build();

    adminUserManagementClient =
        new UserManagementClient(
            adminEnvironment.getGreg().getBackEndUrl(),
            adminEnvironment.getGreg().getSessionCookie());
    user1UserManagementClient =
        new UserManagementClient(
            user1Environment.getGreg().getBackEndUrl(),
            user1Environment.getGreg().getSessionCookie());
    ROLE_USERS = new String[] {userInfo.getUserNameWithoutDomain()};
    // setup roles
    adminUserManagementClient.addRole(ROLE_NAME, ROLE_USERS, SECURITY_PERMISSION_LIST);
    adminUserManagementClient.updateUserListOfRole(EXISTING_ROLE, new String[] {}, ROLE_USERS);
  }
Exemple #3
0
 @Test(dependsOnMethods = "testCreateRole")
 public void testAddUserToRole() throws Exception {
   user1UserManagementClient.updateUserListOfRole(
       NEW_ROLE, new String[] {NEW_USER}, new String[] {});
   Assert.assertTrue(adminUserManagementClient.userNameExists(NEW_ROLE, NEW_USER));
 }