protected void deleteTestUser(String username) throws Exception { UsersGroupsBasePage page = login().getAdminCenter().getUsersGroupsHomePage(); UsersTabSubPage usersTab = page.getUsersTab(); usersTab = usersTab.searchUser(username); usersTab = usersTab.viewUser(username).deleteUser(); usersTab = usersTab.searchUser(username); assertFalse(usersTab.isUserFound(username)); logout(); }
private void prepare() throws UserNotConnectedException, IOException { DocumentBasePage documentBasePage; DocumentBasePage s = login(); // Create a new user if not exist UsersGroupsBasePage page; UsersTabSubPage usersTab = s.getAdminCenter().getUsersGroupsHomePage().getUsersTab(); usersTab = usersTab.searchUser(TEST_USERNAME); if (!usersTab.isUserFound(TEST_USERNAME)) { page = usersTab .getUserCreatePage() .createUser( TEST_USERNAME, TEST_USERNAME, null, null, TEST_USERNAME, TEST_PASSWORD, "members"); usersTab = page.getUsersTab(true); } // search user usersTab = usersTab.searchUser(TEST_USERNAME); assertTrue(usersTab.isUserFound(TEST_USERNAME)); // create a wokspace1 and grant all rights to the test user documentBasePage = usersTab .exitAdminCenter() .getHeaderLinks() .getNavigationSubPage() .goToDocument("Workspaces"); DocumentBasePage workspacePage = createWorkspace(documentBasePage, WORKSPACE1_TITLE, null); PermissionsSubPage permissionsSubPage = workspacePage.getPermissionsTab(); // Need Read if (!permissionsSubPage.hasPermissionForUser("Read", TEST_USERNAME)) { permissionsSubPage.grantPermissionForUser("Read", TEST_USERNAME); } // Create test File 1 createFile(workspacePage, FILE1_NAME, null, false, null, null, null); workspacePage.getHeaderLinks().getNavigationSubPage().goToDocument("Workspaces"); workspacePage = createWorkspace(documentBasePage, WORKSPACE2_TITLE, null); permissionsSubPage = workspacePage.getPermissionsTab(); if (!permissionsSubPage.hasPermissionForUser("Manage everything", TEST_USERNAME)) { permissionsSubPage.grantPermissionForUser("Manage everything", TEST_USERNAME); } logout(); }
protected void createTestUser(String username, String pswd) throws Exception { UsersGroupsBasePage page; UsersTabSubPage usersTab = login().getAdminCenter().getUsersGroupsHomePage().getUsersTab(); usersTab = usersTab.searchUser(username); if (!usersTab.isUserFound(username)) { page = usersTab .getUserCreatePage() .createUser(username, username, "lastname1", "company1", "email1", pswd, "members"); usersTab = page.getUsersTab(true); } // search user usersTab = usersTab.searchUser(username); assertTrue(usersTab.isUserFound(username)); logout(); }
/** @since 5.9.2 */ private void restoreState() throws Exception { UsersTabSubPage usersTab = login().getAdminCenter().getUsersGroupsHomePage().getUsersTab(); usersTab = usersTab.searchUser(TEST_USERNAME); usersTab = usersTab.viewUser(TEST_USERNAME).deleteUser(); DocumentBasePage documentBasePage = usersTab .exitAdminCenter() .getHeaderLinks() .getNavigationSubPage() .goToDocument("Workspaces"); deleteWorkspace(documentBasePage, WORKSPACE_TITLE); logout(); }