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(); }
@Test public void testModifyWsDescription() throws Exception { // As an administrator, check that jsmith is created and has rights UsersGroupsBasePage usergroupPage = login().getAdminCenter().getUsersGroupsHomePage(); UsersTabSubPage page = usergroupPage.getUsersTab().searchUser(TEST_USERNAME); if (!page.isUserFound(TEST_USERNAME)) { usergroupPage = page.getUserCreatePage() .createUser( TEST_USERNAME, "John", "Smith", "Nuxeo", "*****@*****.**", TEST_PASSWORD, "members"); } DocumentBasePage documentBasePage = usergroupPage .exitAdminCenter() .getHeaderLinks() .getNavigationSubPage() .goToDocument("Workspaces"); PermissionsSubPage permissionsSubPage = documentBasePage.getPermissionsTab(); // Need WriteSecurity (so in practice Manage everything) to edit a // Workspace if (!permissionsSubPage.hasPermissionForUser("Manage everything", TEST_USERNAME)) { permissionsSubPage.grantPermissionForUser("Manage everything", TEST_USERNAME); } logout(); // Starting the test for real documentBasePage = login(TEST_USERNAME, TEST_PASSWORD).getContentTab().goToDocument("Workspaces"); // Create a new workspace named 'WorkspaceDescriptionModify_{current // time}' DocumentBasePage workspacePage = createWorkspace(documentBasePage, WORKSPACE_TITLE, "A workspace description"); // Modify Workspace description String descriptionModified = "Description modified"; workspacePage = workspacePage.getEditTab().edit(null, descriptionModified, null); assertEquals(descriptionModified, workspacePage.getCurrentFolderishDescription()); assertEquals(WORKSPACE_TITLE, workspacePage.getCurrentDocumentTitle()); // Clean up repository restoreState(); // Logout 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(); }
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(); }