/** * The resource associated with the request * @return Resource */ public function resource() { if (!$this->_route->resource_name()) { return NULL; } return Resource::get($this->_route->resource_name())->param($this->param()); }
/** * Scenario : The contextual menu should disappear after changing workspace * Given I am logged in as Ada on the password workspace * And I right click on a password * Then I should see the contextual menu * When I go to user workspace * Then I should not see the contextual menu anymore * When I right click on a user * Then I should see the contextual menu * When I go to password workspace * Then I should not see the contextual menu * When I right click again on the previous password where I had clicked. * Then I should see again the contextual menu */ public function testContextualMenuDisappearAfterChangingWorkspace() { // Given I am Ada $user = User::get('ada'); // And I am logged in on the password workspace $this->setClientConfig($user); $this->loginAs($user); // When I right click on a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); $this->rightClickPassword($resource['id']); // Then I can see the contextual menu $this->assertVisible('js_contextual_menu'); // When I change workspace $this->gotoWorkspace('user'); // Then I shouldn't see the contextual menu anymore $this->assertNotVisible('js_contextual_menu'); // And I right click on user betty $betty = User::get(array('user' => 'betty')); $this->rightClickUser($betty['id']); // Then I can see the contextual menu $this->assertVisible('js_contextual_menu'); // When I change workspace $this->gotoWorkspace('password'); // Then I shouldn't see the contextual menu anymore $this->assertNotVisible('js_contextual_menu'); // And I right click on the password I clicked before. $this->rightClickPassword($resource['id']); // Then I can see the contextual menu $this->assertVisible('js_contextual_menu'); }
/** * Scenario: As a user editing my password encryption should not happen if do not edit the secret * @throws Exception */ public function testNoEncryptionOnResourceNameEdit() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // And I am editing the name, description, uri, username of a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); $r['id'] = $resource['id']; $r['description'] = 'this is a new description'; $r['name'] = 'newname'; $r['username'] = '******'; $r['uri'] = 'http://newuri.com'; $this->gotoEditPassword($r['id']); $this->inputText('js_field_name', $r['name']); $this->inputText('js_field_username', $r['username']); $this->inputText('js_field_uri', $r['uri']); $this->inputText('js_field_description', $r['description']); // And I click the submit button $this->click('.edit-password-dialog input[type=submit]'); // For one second, every 1/10 seconds, check that the popup is not visible. for ($i = 0; $i < 10; $i++) { $this->assertNotVisible('passbolt-iframe-progress-dialog'); usleep(100000); } // Then I should see a success notification message saying the password is updated. $this->assertNotification('app_resources_edit_success'); }
/** * Executes request on link. * * @param string $url * @param string $method * @param array $postfields * @return null|string */ private function request($url, $method = 'GET', $postfields = []) { switch (strtolower($method)) { case "get": return $this->ch->get($url); break; case "post": return $this->ch->post($url, $postfields); break; } return null; }
/** * Scenario : As a user I can have my passphrase remembered by the system. * * Given I am Ada * And I am logged in on the password workspace * When I click on a password in the list * And I click on the link 'copy password' * Then I should see the passphrase dialog. * And I should see a checkbox remember my passphrase. * When I enter my passphrase from keyboard only * Then The password should have been copied to clipboard * When I click on another password in the list * And I click on the link 'copy password' * Then I should see the passphrase dialog * When I enter my passphrase from keyboard only * And I check the remember checkbox * Then The password should have been copied to clipboard * When I click on another password in the list * And I click again on the copy button in the action bar * Then The password should have been copied to clipboard */ function testMasterPasswordRemember() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // When I click on a password in the list $rsA = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.apache'))); $this->clickPassword($rsA['id']); // And I click on the link 'copy password' $this->click('js_wk_menu_secretcopy_button'); // Then I should see the passphrase dialog. $this->assertMasterPasswordDialog($user); // And I should see a checkbox remember my passphrase $this->goIntoMasterPasswordIframe(); $this->assertVisible('js_remember_master_password'); $this->goOutOfIframe(); // When I enter my passphrase from keyboard only $this->enterMasterPassword($user['MasterPassword'], false); // Then The password should have been copied to clipboard $this->waitCompletion(); $this->assertClipboard($rsA['password']); // When I click on another password in the list $rsB = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.bower'))); $this->clickPassword($rsB['id']); // And I click on the link 'copy password' $this->click('js_wk_menu_secretcopy_button'); // Then I should see the passphrase dialog $this->assertMasterPasswordDialog($user); // When I enter my passphrase from keyboard only // And I check the remember checkbox $this->enterMasterPassword($user['MasterPassword'], true); // Then The password should have been copied to clipboard $this->waitCompletion(); $this->assertClipboard($rsB['password']); // When I click on another password in the list $rsC = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.centos'))); $this->clickPassword($rsC['id']); // And I click on the link 'copy password' $this->click('js_wk_menu_secretcopy_button'); // Then The password should have been copied to clipboard $this->waitCompletion(); $this->assertClipboard($rsC['password']); }
private function _resource(Resource $resource) { $resource_string = "\n" . Minion_CLI::color(' ' . $resource->name(), 'green'); if ($this->_options['actions'] !== FALSE) { $resource_string .= $this->_resource_actions($resource); } elseif ($this->_options['uris'] !== FALSE) { $resource_string .= $this->_resource_uris($resource); } foreach ($resource->children() as $child_resource_name) { $resource_string .= "\n" . ' ' . Minion_CLI::color(substr($child_resource_name, strlen($resource->name()) + 1), 'cyan'); if ($this->_options['actions'] !== FALSE) { $resource_string .= $this->_resource_actions(Resource::get($child_resource_name), ' '); } elseif ($this->_options['uris'] !== FALSE) { $resource_string .= $this->_resource_uris(Resource::get($child_resource_name), ' '); } } $resource_string .= "\n"; return $resource_string; }
/** * Scenario: As LU I can't select multiple passwprd * * Given I am Ada * And I am logged in on the password workspace * When I click on a password checkbox * Then I should see the password selected * When I click on another password checkbox * Then I should see only the last password selected * */ public function testCantSelectMultiplePasswords() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged on the password workspace $this->loginAs($user); // When I click on a user checkbox $rsA = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.apache'))); $this->click('multiple_select_checkbox_' . $rsA['id']); // Then I should see it selected $this->isPasswordSelected($rsA['id']); // When click on another user checkbox $rsG = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.gnupg'))); $this->click('multiple_select_checkbox_' . $rsG['id']); // Then I should see only the last user selected $this->assertPasswordSelected($rsG['id']); $this->assertPasswordNotSelected($rsA['id']); }
/** * The contextual menu should close after a click / not remain open. * Given I am Ada * And the database is in the default state * And I am logged in on the password workspace * And I right click on an item I own * Then I can see the contextual menu * When I click on the edit link * Then I cannot see the contextual menu */ public function testContextualMenuMustCloseAfterClick() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Given I am Ada $user = User::get('ada'); $resource = Resource::get(array('user' => 'ada')); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // And I right click on an item I own $this->rightClickPassword($resource['id']); // Then I can see the contextual menu $this->assertVisible('js_contextual_menu'); // When I click on the edit link $this->click('#js_password_browser_menu_edit a'); // Then I cannot see the contextual menu $this->assertNotVisible('js_contextual_menu'); }
public function testOnClickSessionExpiredManualRedirect() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // Reduce the session timeout to accelerate the test PassboltServer::setExtraConfig(['Session' => ['timeout' => 0.25]]); // And I am logged in on the password workspace $this->loginAs($user); sleep(15); // When I click on a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); $this->clickPassword($resource['id']); // Then I should see the session expired dialog $this->assertSessionExpiredDialog(); // When I click on Redirect now $this->click('confirm-button'); // Then I should see the login page $this->waitUntilISee('.plugin-check.' . $this->_browser['type'] . '.success'); }
public function load() { parent::load(); //$this->view->ruler = $this->generateRuler($this->view->start_time, $this->view->end_time); $this->view->rgs = $this->rgs; //message("success", "Hello there"); $model = new ResourceGroup(); $this->view->resource_groups = $model->getindex(); $resource_model = new Resource(); $resource_service_model = new ResourceServices(); $this->view->resources = array(); $this->view->services = array(); foreach ($this->rgs as $rg) { foreach ($rg as $rid => $resource) { //load resource detail $recs = $resource_model->get(array("resource_id" => $rid)); $this->view->resources[$rid] = $recs[0]; //load service info $params = array("resource_id" => $rid); $this->view->services[$rid] = $resource_service_model->get($params); } } }
public function get(\Engine\IResponse $response) { parent::get($response); $response->sendData(["url" => $this->url->getUrl(), "method" => $this->method->getMethod(), "get" => $this->get, "Provider\\Test" => $this->provider->get("Test")->checkIfWorking()]); }
/** * Scenario: As a user I can copy my password to clipboard by clicking on the password preview in the sidebar * * Given I am Ada * And I am logged in on the password workspace * When I click on the resource row in the grid * And I click on a the copy secret password link in the sidebar * And I enter my passphrase * Then the password is copied to clipboard */ public function testCopyPasswordToClipboardViaSidebarSecretCopy() { // Given I am Ada $user = User::get('ada'); $resource = Resource::get(array('user' => 'ada')); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // When I click on the resource row in the grid $this->clickPassword($resource['id']); // And I click on a the copy secret password link in the sidebar $this->click('sidebar_secret_copy_' . $resource['id']); // And I enter my passphrase $this->enterMasterPassword($user['MasterPassword']); // Then I can see a success message saying the username was copied to clipboard $this->assertNotification('plugin_secret_copy_success'); // Then the password is copied to clipboard $this->assertClipboard($resource['password']); }
/** * */ public static function cleanup() { // remove database tmp table $db = Resource::get(); $db->query("DROP TABLE IF EXISTS `" . self::$tmpTable . "`"); //delete tmp data recursiveDelete(PIMCORE_SYSTEM_TEMP_DIRECTORY . "/update", true); }
/** * Scenario : As a user I should receive an email notification when I write a comment. * Given I am Ada * And I am logged in * And I click on a password * Then I should see the section comments in the sidebar * And I should see the comment form with a submit button * Given I am enter a comment in the textearea * And I click on the send button * Then I should see a notification saying that the comment has been added * When I access the last email sent to a person the password is shared with (not me) * Then I should see that the title contains 'myname' commented on 'resourcename' * And I should see that the email contains the resource name * And I should see that the email containe the comment content */ public function testCommentAddEmailNotification() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Define comment. $comment = 'this is a comment'; // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // Make sure the password field is not visible $this->assertNotVisible($this->commentFormSelector); // When I click on a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); $this->clickPassword($resource['id']); // Enter comment and submit. $this->postCommentInSidebar($comment); // Access last email sent to Betty. $this->getUrl('seleniumTests/showLastEmail/' . urlencode(User::get('betty')['Username'])); // The email title should be: $this->assertMetaTitleContains(sprintf('%s commented on %s', $user['FirstName'], $resource['name'])); // I should see the resource name in the email. $this->assertElementContainsText('bodyTable', $user['FirstName'] . ' ' . $user['LastName']); // I should see the resource name in the email. $this->assertElementContainsText('bodyTable', $comment); // I should see the comment in the email $this->assertElementContainsText('bodyTable', $comment); }
/** * @group no-saucelabs * * Scenario: As LU I should be able to edit a password after I close and restore the passbolt tab * Given I am Ada * And I am on second tab * And I am logged in on the passwords workspace * When I close and restore the tab * Then I should be able to edit a password * * @throws Exception */ public function testCloseRestoreTabAndEditPassword() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am on second tab $this->openNewTab(); // And I am logged in on the password workspace $this->loginAs($user); // When I close and restore the tab $this->closeAndRestoreTab(); $this->waitCompletion(); // Then I should be able to edit a password $r1 = Resource::get(array('user' => 'betty', 'permission' => 'update')); $r2 = array('id' => $r1['id'], 'password' => 'our_brand_new_password'); $this->editPassword($r2, $user); }
/** * Scenario: As a user I can edit the secret of a password I have own, * and enter my passphrase from keyboard only, using tab first. * * Given I am Ada * And I am logged in on the password workspace * And I am editing a password I own * When I click on the secret password field * Then I see the passphrase dialog * When I press tab * Then I can see that the passphrase field gets the focus * When I type my passphrase on the keyboard * And I press enter * Then I can see the password decrypted in the secret field */ function testMasterPasswordShortcutTabFirstEditPasswordSecret() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in $this->loginAs($user); // And I am editing a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); $this->gotoEditPassword($resource['id']); // When I switch to the password iframe $this->goIntoSecretIframe(); $this->click('js_secret'); $this->goOutOfIframe(); // When I enter my passphrase from keyboard only, by pressing tab first. $this->enterMasterPasswordWithKeyboardShortcuts($user['MasterPassword'], true); $this->goIntoSecretIframe(); // Wait for password to be decrypted. $this->waitUntilSecretIsDecryptedInField(); $this->assertInputValue('js_secret', $resource['password']); $this->goOutOfIframe(); }
/** * Scenario : As a user I should'nt be able to edit the description of a password with read access only * Given I am Ada and I am logged in on the password workspace * When I click on a password with read access only * Then I should see the description in the sidebar * And I should not see an edit button for the description * When I click on the description * Then I should not see a form to edit the description * * @throws Exception */ public function testEditDescriptionNotAllowed() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // Make sure the password field is not visible $this->assertNotVisible(".js_rs_details_edit_description textarea"); // When I click on a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'read')); $this->clickPassword($resource['id']); // I should not see the edit button. $this->assertNotVisible("js_edit_description_button"); // Click on the description $this->click("#js_rs_details_description p.description_content"); // Make sure password field is not visible. $this->assertNotVisible("#js_rs_details_edit_description textarea"); }
/** * Scenario: As a user I should receive a notification email on password deletion * * And I am Ada * And I am logged in on the password workspace * When I click a password I have update right on * And I click on the more button * And I click on the delete link * Then I should see a success notification message saying the password is deleted * When I access the last notification email for this user * Then I should see a notification email stating that the password has been deleted * When I access the last notification email of a user the password was shared with * Then I should see a notification email stating that the password has been deleted */ public function testDeletePasswordEmailNotification() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // And I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); // When I click a password I have update right on $resource = Resource::get(array('user' => 'ada', 'permission' => 'update')); $this->clickPassword($resource['id']); // And I click on the more button $this->click('js_wk_menu_more_button'); // When I click on the delete link $this->clickLink('delete'); // Assert that the confirmation dialog is displayed. $this->assertConfirmationDialog('Do you really want to delete password ?'); // Click ok in confirmation dialog. $this->confirmActionInConfirmationDialog(); // Then I should see a success notification message saying the password is deleted $this->assertNotification('app_resources_delete_success'); // Access last email sent to Betty. $this->getUrl('seleniumTests/showLastEmail/' . $user['Username']); // The email title should be: $this->assertMetaTitleContains(sprintf('Password %s has been deleted', $resource['name'])); // I should see the user name in the email. $this->assertElementContainsText('bodyTable', 'You (' . $user['Username'] . ')'); // I should see the resource name in the email. $this->assertElementContainsText('bodyTable', $resource['name']); // Get the details of betty, with whom the password is shared. $betty = User::get('betty'); // Access last email sent to Betty. $this->getUrl('seleniumTests/showLastEmail/' . $betty['Username']); // The email title should be: $this->assertMetaTitleContains(sprintf('Password %s has been deleted', $resource['name'])); // I should see the user name in the email. $this->assertElementContainsText('bodyTable', $user['FirstName'] . ' ' . $user['LastName'] . ' (' . $user['Username'] . ')'); // I should see the resource name in the email. $this->assertElementContainsText('bodyTable', $resource['name']); }
/** * Scenario: As a user I can share a password with other users after I close and restore the passbolt tab * * Given I am Carol * And I am on second tab * And I am logged in on the password workspace * When I close and restore the tab * And I go to the sharing dialog of a password I own * And I give read access to betty for a password I own * Then I can see Betty has read access on the password */ public function testCloseRestoreTabAndSharePassword() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Given I am Carol $user = User::get('carol'); $this->setClientConfig($user); // And I am on second tab $this->openNewTab(); // And I am logged in on the password workspace $this->loginAs($user); // When I close and restore the tab $this->closeAndRestoreTab(); $this->waitCompletion(); // And I go to the sharing dialog of a password I own $resource = Resource::get(array('user' => 'betty', 'id' => Uuid::get('resource.id.gnupg'))); $this->gotoSharePassword(Uuid::get('resource.id.gnupg')); // And I give read access to betty for a password I own $this->sharePassword($resource, 'betty', $user); // Then I can see Betty has read access on the password $this->assertPermission($resource, '*****@*****.**', 'can read'); }
/** * Scenario: As LU I can share a password mutliple times * * Given I am logged in as ada in the user workspace * * [LOOP] * When I am sharing a password I own * Then I should expect the password has been shared with success * [END_LOOP] * */ public function testSharePasswordMultipleTimes() { // Reset database at the end of test. $this->resetDatabaseWhenComplete(); // Given I am logged in as ada in the user workspace $user = User::get('ada'); $this->setClientConfig($user); $this->loginAs($user); $resource = Resource::get(array('id' => Uuid::get('resource.id.apache'), 'user' => 'ada')); $shareWith = ['frances', 'edith', 'admin']; for ($i = 0; $i < count($shareWith); $i++) { // And I am editing the secret of a password I own // Then I can see a success notification $r['id'] = $resource['id']; $r['password'] = '******' . $i; $this->sharePassword($resource, $shareWith[$i], $user); $this->waitUntilNotificationDisappears('app_share_update_success'); } }
/** * Get the resource for the route * @return Resource */ public function resource() { if (!$this->_resource_name) { return NULL; } return Resource::get($this->resource_name()); }
/** * Scenario: As a logged in user, I should be able to control the sidebar visibility through the sidebar button * Given I am logged in as ada * And I am on the password workspace * Then I should see that the sidebar button is pressed * And I should not see the sidebar * When I click on a resource to select it * Then I should see the sidebar * When I click on the same resource to deselect it * Then I should not see the sidebar anymore * When I click on the same resource to select it * Then I should see that the sidebar is visible again * When I toggle off the sidebar button * Then I should see that the sidebar button is now deactivated * And I should not see the sidebar anymore * When I click on the resource again to deselect it * Then I should see that the sidebar button is deactivated * And I should see that the sidebar is not visible * When I toggle in the sidebar button * Then I should see that the sidebar is not visible * When I click on the resource again to select it * Then I should see that the sidebar is visible * When I click on the close button at the top of the sidebar * Then I should see that the sidebar button is deactivated * And I should not see the sidebar anymore */ public function testSidebarVisibility() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); $this->assertToggleButtonStatus('js_wk_secondary_menu_view_sidebar_button', TOGGLE_BUTTON_PRESSED); // I should not see the sidebar $this->assertNotVisible('#js_pwd_details'); // And I am editing a password I own $resource = Resource::get(array('user' => 'ada', 'permission' => 'owner')); // Click on a password $this->clickPassword($resource['id']); // I should see a secondary side bar appearing $this->assertVisible('#js_pwd_details'); // Click on a password to deselect it $this->clickPassword($resource['id']); // I should not see the secondary sidebar $this->assertNotVisible('#js_pwd_details'); // Click on a password $this->clickPassword($resource['id']); // I should that the sidebar is visible again $this->assertVisible('#js_pwd_details'); // Click on the sidebar button. $this->click('js_wk_secondary_menu_view_sidebar_button'); // I should see that the button is not pressed. $this->assertToggleButtonStatus('js_wk_secondary_menu_view_sidebar_button', TOGGLE_BUTTON_UNPRESSED); // I should not see the sidebar anymore. $this->assertNotVisible('#js_pwd_details'); // Click on the password again to deselect it. $this->clickPassword($resource['id']); // The toggle button should still be unpressed. $this->assertToggleButtonStatus('js_wk_secondary_menu_view_sidebar_button', TOGGLE_BUTTON_UNPRESSED); // I should not see the sidebar. $this->assertNotVisible('#js_pwd_details'); // Click on the sidebar button to toggle it in. $this->click('js_wk_secondary_menu_view_sidebar_button'); // The toggle button should still be pressed. $this->assertToggleButtonStatus('js_wk_secondary_menu_view_sidebar_button', TOGGLE_BUTTON_PRESSED); // I should not see the sidebar. $this->assertNotVisible('#js_pwd_details'); // Click on the password again to select it. $this->clickPassword($resource['id']); // I should that the sidebar is visible $this->assertVisible('#js_pwd_details'); // I click on the button close at the top of the dialogue. $this->click('#js_pwd_details .js_sidebar_close'); // I should see that the sidebar button is deactivated $this->assertToggleButtonStatus('js_wk_secondary_menu_view_sidebar_button', TOGGLE_BUTTON_UNPRESSED); // Then I should not see the sidebar anymore. $this->assertNotVisible('#js_pwd_details'); }
/** * Scenario: As a admin I can copy the public key to clipboard with the copy button in the sidebar * * Given I am Admin * And I am logged in on the user workspace * When I click on the user betty * And I click on a the copy public key link in the sidebar * Then the public key is copied to clipboard */ public function testCopyPublicKeyToClipboardViaSidebarCopy() { // Given I am Ada $user = User::get('ada'); $resource = Resource::get(array('user' => 'ada')); $this->setClientConfig($user); // And I am logged in on the password workspace $this->loginAs($user); $this->gotoWorkspace('user'); // Get user betty $betty = User::get('betty'); // When I click on the user betty $this->clickUser($betty['id']); // And I click on a the copy secret password link in the sidebar $this->click('#js_user_details a.copy-public-key'); // Then I can see a success message telling me the public key was copied to clipboard $this->assertNotification('plugin_clipboard_copy_success'); // And the content of the clipboard is valid $this->assertClipboard(file_get_contents(GPG_FIXTURES . DS . 'betty_public.key')); }