\n";
},"useData":true});
})();
\ No newline at end of file
diff --git a/apps/settings/js/templates/federationscopemenu.handlebars b/apps/settings/js/templates/federationscopemenu.handlebars
index 4bd945b094..c9d86c6314 100644
--- a/apps/settings/js/templates/federationscopemenu.handlebars
+++ b/apps/settings/js/templates/federationscopemenu.handlebars
@@ -1,7 +1,12 @@
@@ -196,9 +193,7 @@ script('settings', [
placeholder="t('Your phone number')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" />
-
-
-
+ class="corrupted-scope-value">
@@ -220,9 +215,7 @@ script('settings', [
value=""
autocomplete="on" autocapitalize="none" autocorrect="off" />
-
-
-
+ class="corrupted-scope-value">
@@ -275,9 +268,7 @@ script('settings', [
} ?>
/>
-
-
-
+ class="corrupted-scope-value">
@@ -330,9 +321,7 @@ script('settings', [
} ?>
/>
-
-
-
+ class="corrupted-scope-value">
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 9029b1af39..1510aad55a 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -30,6 +30,7 @@ use OC\Accounts\AccountManager;
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
use OC\Group\Manager;
use OCA\Settings\Controller\UsersController;
+use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\BackgroundJob\IJobList;
@@ -165,6 +166,51 @@ class UsersControllerTest extends \Test\TestCase {
}
}
+ protected function getDefaultAccountManagerUserData() {
+ return [
+ IAccountManager::PROPERTY_DISPLAYNAME =>
+ [
+ 'value' => 'Default display name',
+ 'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ IAccountManager::PROPERTY_ADDRESS =>
+ [
+ 'value' => 'Default address',
+ 'scope' => IAccountManager::VISIBILITY_PRIVATE,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ IAccountManager::PROPERTY_WEBSITE =>
+ [
+ 'value' => 'Default website',
+ 'scope' => IAccountManager::VISIBILITY_PRIVATE,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ IAccountManager::PROPERTY_EMAIL =>
+ [
+ 'value' => 'Default email',
+ 'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ IAccountManager::PROPERTY_AVATAR =>
+ [
+ 'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY
+ ],
+ IAccountManager::PROPERTY_PHONE =>
+ [
+ 'value' => 'Default phone',
+ 'scope' => IAccountManager::VISIBILITY_PRIVATE,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ IAccountManager::PROPERTY_TWITTER =>
+ [
+ 'value' => 'Default twitter',
+ 'scope' => IAccountManager::VISIBILITY_PRIVATE,
+ 'verified' => IAccountManager::VERIFIED,
+ ],
+ ];
+ }
+
/**
* @dataProvider dataTestSetUserSettings
*
@@ -189,48 +235,7 @@ class UsersControllerTest extends \Test\TestCase {
$this->accountManager->expects($this->once())
->method('getUser')
->with($user)
- ->willReturn([
- AccountManager::PROPERTY_DISPLAYNAME =>
- [
- 'value' => 'Display name',
- 'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- AccountManager::PROPERTY_ADDRESS =>
- [
- 'value' => '',
- 'scope' => AccountManager::VISIBILITY_PRIVATE,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- AccountManager::PROPERTY_WEBSITE =>
- [
- 'value' => '',
- 'scope' => AccountManager::VISIBILITY_PRIVATE,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- AccountManager::PROPERTY_EMAIL =>
- [
- 'value' => '',
- 'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- AccountManager::PROPERTY_AVATAR =>
- [
- 'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY
- ],
- AccountManager::PROPERTY_PHONE =>
- [
- 'value' => '',
- 'scope' => AccountManager::VISIBILITY_PRIVATE,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- AccountManager::PROPERTY_TWITTER =>
- [
- 'value' => '',
- 'scope' => AccountManager::VISIBILITY_PRIVATE,
- 'verified' => AccountManager::NOT_VERIFIED,
- ],
- ]);
+ ->willReturn($this->getDefaultAccountManagerUserData());
$controller->expects($this->once())->method('saveUserSettings');
} else {
@@ -265,6 +270,269 @@ class UsersControllerTest extends \Test\TestCase {
];
}
+ public function testSetUserSettingsWhenUserDisplayNameChangeNotAllowed() {
+ $controller = $this->getController(false, ['saveUserSettings']);
+ $user = $this->createMock(IUser::class);
+
+ $this->userSession->method('getUser')->willReturn($user);
+
+ $defaultProperties = $this->getDefaultAccountManagerUserData();
+
+ $this->accountManager->expects($this->once())
+ ->method('getUser')
+ ->with($user)
+ ->willReturn($defaultProperties);
+
+ $this->config->expects($this->once())
+ ->method('getSystemValue')
+ ->with('allow_user_to_change_display_name')
+ ->willReturn(false);
+
+ $this->appManager->expects($this->once())
+ ->method('isEnabledForUser')
+ ->with('federatedfilesharing')
+ ->willReturn(true);
+
+ $avatarScope = IAccountManager::VISIBILITY_PUBLIC;
+ $displayName = 'Display name';
+ $displayNameScope = IAccountManager::VISIBILITY_PUBLIC;
+ $phone = '47658468';
+ $phoneScope = IAccountManager::VISIBILITY_PUBLIC;
+ $email = 'john@example.com';
+ $emailScope = IAccountManager::VISIBILITY_PUBLIC;
+ $website = 'nextcloud.com';
+ $websiteScope = IAccountManager::VISIBILITY_PUBLIC;
+ $address = 'street and city';
+ $addressScope = IAccountManager::VISIBILITY_PUBLIC;
+ $twitter = '@nextclouders';
+ $twitterScope = IAccountManager::VISIBILITY_PUBLIC;
+
+ // Display name and email are not changed.
+ $expectedProperties = $defaultProperties;
+ $expectedProperties[IAccountManager::PROPERTY_AVATAR]['scope'] = $avatarScope;
+ $expectedProperties[IAccountManager::PROPERTY_PHONE]['value'] = $phone;
+ $expectedProperties[IAccountManager::PROPERTY_PHONE]['scope'] = $phoneScope;
+ $expectedProperties[IAccountManager::PROPERTY_WEBSITE]['value'] = $website;
+ $expectedProperties[IAccountManager::PROPERTY_WEBSITE]['scope'] = $websiteScope;
+ $expectedProperties[IAccountManager::PROPERTY_ADDRESS]['value'] = $address;
+ $expectedProperties[IAccountManager::PROPERTY_ADDRESS]['scope'] = $addressScope;
+ $expectedProperties[IAccountManager::PROPERTY_TWITTER]['value'] = $twitter;
+ $expectedProperties[IAccountManager::PROPERTY_TWITTER]['scope'] = $twitterScope;
+
+ $this->mailer->expects($this->once())->method('validateMailAddress')
+ ->willReturn(true);
+
+ $controller->expects($this->once())
+ ->method('saveUserSettings')
+ ->with($user, $expectedProperties)
+ ->willReturnArgument(1);
+
+ $result = $controller->setUserSettings(
+ $avatarScope,
+ $displayName,
+ $displayNameScope,
+ $phone,
+ $phoneScope,
+ $email,
+ $emailScope,
+ $website,
+ $websiteScope,
+ $address,
+ $addressScope,
+ $twitter,
+ $twitterScope
+ );
+ }
+
+ public function testSetUserSettingsWhenFederatedFilesharingNotEnabled() {
+ $controller = $this->getController(false, ['saveUserSettings']);
+ $user = $this->createMock(IUser::class);
+
+ $this->userSession->method('getUser')->willReturn($user);
+
+ $defaultProperties = $this->getDefaultAccountManagerUserData();
+
+ $this->accountManager->expects($this->once())
+ ->method('getUser')
+ ->with($user)
+ ->willReturn($defaultProperties);
+
+ $this->appManager->expects($this->once())
+ ->method('isEnabledForUser')
+ ->with('federatedfilesharing')
+ ->willReturn(false);
+
+ $avatarScope = IAccountManager::VISIBILITY_PUBLIC;
+ $displayName = 'Display name';
+ $displayNameScope = IAccountManager::VISIBILITY_PUBLIC;
+ $phone = '47658468';
+ $phoneScope = IAccountManager::VISIBILITY_PUBLIC;
+ $email = 'john@example.com';
+ $emailScope = IAccountManager::VISIBILITY_PUBLIC;
+ $website = 'nextcloud.com';
+ $websiteScope = IAccountManager::VISIBILITY_PUBLIC;
+ $address = 'street and city';
+ $addressScope = IAccountManager::VISIBILITY_PUBLIC;
+ $twitter = '@nextclouders';
+ $twitterScope = IAccountManager::VISIBILITY_PUBLIC;
+
+ // Phone, website, address and twitter are not changed.
+ $expectedProperties = $defaultProperties;
+ $expectedProperties[IAccountManager::PROPERTY_AVATAR]['scope'] = $avatarScope;
+ $expectedProperties[IAccountManager::PROPERTY_DISPLAYNAME]['value'] = $displayName;
+ $expectedProperties[IAccountManager::PROPERTY_DISPLAYNAME]['scope'] = $displayNameScope;
+ $expectedProperties[IAccountManager::PROPERTY_EMAIL]['value'] = $email;
+ $expectedProperties[IAccountManager::PROPERTY_EMAIL]['scope'] = $emailScope;
+
+ $this->mailer->expects($this->once())->method('validateMailAddress')
+ ->willReturn(true);
+
+ $controller->expects($this->once())
+ ->method('saveUserSettings')
+ ->with($user, $expectedProperties)
+ ->willReturnArgument(1);
+
+ $result = $controller->setUserSettings(
+ $avatarScope,
+ $displayName,
+ $displayNameScope,
+ $phone,
+ $phoneScope,
+ $email,
+ $emailScope,
+ $website,
+ $websiteScope,
+ $address,
+ $addressScope,
+ $twitter,
+ $twitterScope
+ );
+ }
+
+ /**
+ * @dataProvider dataTestSetUserSettingsSubset
+ *
+ * @param string $property
+ * @param string $propertyValue
+ */
+ public function testSetUserSettingsSubset($property, $propertyValue) {
+ $controller = $this->getController(false, ['saveUserSettings']);
+ $user = $this->createMock(IUser::class);
+
+ $this->userSession->method('getUser')->willReturn($user);
+
+ $defaultProperties = $this->getDefaultAccountManagerUserData();
+
+ $this->accountManager->expects($this->once())
+ ->method('getUser')
+ ->with($user)
+ ->willReturn($defaultProperties);
+
+ $this->appManager->expects($this->once())
+ ->method('isEnabledForUser')
+ ->with('federatedfilesharing')
+ ->willReturn(true);
+
+ $avatarScope = ($property === 'avatarScope') ? $propertyValue : null;
+ $displayName = ($property === 'displayName') ? $propertyValue : null;
+ $displayNameScope = ($property === 'displayNameScope') ? $propertyValue : null;
+ $phone = ($property === 'phone') ? $propertyValue : null;
+ $phoneScope = ($property === 'phoneScope') ? $propertyValue : null;
+ $email = ($property === 'email') ? $propertyValue : null;
+ $emailScope = ($property === 'emailScope') ? $propertyValue : null;
+ $website = ($property === 'website') ? $propertyValue : null;
+ $websiteScope = ($property === 'websiteScope') ? $propertyValue : null;
+ $address = ($property === 'address') ? $propertyValue : null;
+ $addressScope = ($property === 'addressScope') ? $propertyValue : null;
+ $twitter = ($property === 'twitter') ? $propertyValue : null;
+ $twitterScope = ($property === 'twitterScope') ? $propertyValue : null;
+
+ $expectedProperties = $defaultProperties;
+ if ($property === 'avatarScope') {
+ $expectedProperties[IAccountManager::PROPERTY_AVATAR]['scope'] = $propertyValue;
+ }
+ if ($property === 'displayName') {
+ $expectedProperties[IAccountManager::PROPERTY_DISPLAYNAME]['value'] = $propertyValue;
+ }
+ if ($property === 'displayNameScope') {
+ $expectedProperties[IAccountManager::PROPERTY_DISPLAYNAME]['scope'] = $propertyValue;
+ }
+ if ($property === 'phone') {
+ $expectedProperties[IAccountManager::PROPERTY_PHONE]['value'] = $propertyValue;
+ }
+ if ($property === 'phoneScope') {
+ $expectedProperties[IAccountManager::PROPERTY_PHONE]['scope'] = $propertyValue;
+ }
+ if ($property === 'email') {
+ $expectedProperties[IAccountManager::PROPERTY_EMAIL]['value'] = $propertyValue;
+ }
+ if ($property === 'emailScope') {
+ $expectedProperties[IAccountManager::PROPERTY_EMAIL]['scope'] = $propertyValue;
+ }
+ if ($property === 'website') {
+ $expectedProperties[IAccountManager::PROPERTY_WEBSITE]['value'] = $propertyValue;
+ }
+ if ($property === 'websiteScope') {
+ $expectedProperties[IAccountManager::PROPERTY_WEBSITE]['scope'] = $propertyValue;
+ }
+ if ($property === 'address') {
+ $expectedProperties[IAccountManager::PROPERTY_ADDRESS]['value'] = $propertyValue;
+ }
+ if ($property === 'addressScope') {
+ $expectedProperties[IAccountManager::PROPERTY_ADDRESS]['scope'] = $propertyValue;
+ }
+ if ($property === 'twitter') {
+ $expectedProperties[IAccountManager::PROPERTY_TWITTER]['value'] = $propertyValue;
+ }
+ if ($property === 'twitterScope') {
+ $expectedProperties[IAccountManager::PROPERTY_TWITTER]['scope'] = $propertyValue;
+ }
+
+ if (!empty($email)) {
+ $this->mailer->expects($this->once())->method('validateMailAddress')
+ ->willReturn(true);
+ }
+
+ $controller->expects($this->once())
+ ->method('saveUserSettings')
+ ->with($user, $expectedProperties)
+ ->willReturnArgument(1);
+
+ $result = $controller->setUserSettings(
+ $avatarScope,
+ $displayName,
+ $displayNameScope,
+ $phone,
+ $phoneScope,
+ $email,
+ $emailScope,
+ $website,
+ $websiteScope,
+ $address,
+ $addressScope,
+ $twitter,
+ $twitterScope
+ );
+ }
+
+ public function dataTestSetUserSettingsSubset() {
+ return [
+ ['avatarScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['displayName', 'Display name'],
+ ['displayNameScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['phone', '47658468'],
+ ['phoneScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['email', 'john@example.com'],
+ ['emailScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['website', 'nextcloud.com'],
+ ['websiteScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['address', 'street and city'],
+ ['addressScope', IAccountManager::VISIBILITY_PUBLIC],
+ ['twitter', '@nextclouders'],
+ ['twitterScope', IAccountManager::VISIBILITY_PUBLIC],
+ ];
+ }
+
/**
* @dataProvider dataTestSaveUserSettings
*
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index eed0f173ce..b92b85cf4d 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -307,21 +307,31 @@ trait BasicStructure {
* @When Sending a :method to :url with requesttoken
* @param string $method
* @param string $url
+ * @param TableNode|array|null $body
*/
- public function sendingAToWithRequesttoken($method, $url) {
+ public function sendingAToWithRequesttoken($method, $url, $body = null) {
$baseUrl = substr($this->baseUrl, 0, -5);
+ $options = [
+ 'cookies' => $this->cookieJar,
+ 'headers' => [
+ 'requesttoken' => $this->requestToken
+ ],
+ ];
+
+ if ($body instanceof TableNode) {
+ $fd = $body->getRowsHash();
+ $options['form_params'] = $fd;
+ } elseif ($body) {
+ $options = array_merge($options, $body);
+ }
+
$client = new Client();
try {
$this->response = $client->request(
$method,
$baseUrl . $url,
- [
- 'cookies' => $this->cookieJar,
- 'headers' => [
- 'requesttoken' => $this->requestToken
- ]
- ]
+ $options
);
} catch (ClientException $e) {
$this->response = $e->getResponse();
diff --git a/build/integration/features/bootstrap/ContactsMenu.php b/build/integration/features/bootstrap/ContactsMenu.php
new file mode 100644
index 0000000000..30e1dad625
--- /dev/null
+++ b/build/integration/features/bootstrap/ContactsMenu.php
@@ -0,0 +1,69 @@
+
+ *
+ * @author Daniel Calviño Sánchez
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+use PHPUnit\Framework\Assert;
+
+trait ContactsMenu {
+
+ // BasicStructure trait is expected to be used in the class that uses this
+ // trait.
+
+ /**
+ * @When /^searching for contacts matching with "([^"]*)"$/
+ *
+ * @param string $filter
+ */
+ public function searchingForContactsMatchingWith(string $filter) {
+ $url = '/index.php/contactsmenu/contacts';
+
+ $parameters[] = 'filter=' . $filter;
+
+ $url .= '?' . implode('&', $parameters);
+
+ $this->sendingAToWithRequesttoken('POST', $url);
+ }
+
+ /**
+ * @Then /^the list of searched contacts has "(\d+)" contacts$/
+ */
+ public function theListOfSearchedContactsHasContacts(int $count) {
+ $this->theHTTPStatusCodeShouldBe(200);
+
+ $searchedContacts = json_decode($this->response->getBody(), $asAssociativeArray = true)['contacts'];
+
+ Assert::assertEquals($count, count($searchedContacts));
+ }
+
+ /**
+ * @Then /^searched contact "(\d+)" is named "([^"]*)"$/
+ *
+ * @param int $index
+ * @param string $expectedName
+ */
+ public function searchedContactXIsNamed(int $index, string $expectedName) {
+ $searchedContacts = json_decode($this->response->getBody(), $asAssociativeArray = true)['contacts'];
+ $searchedContact = $searchedContacts[$index];
+
+ Assert::assertEquals($expectedName, $searchedContact['fullName']);
+ }
+}
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php
index 66e2282608..18e5eb3363 100644
--- a/build/integration/features/bootstrap/FeatureContext.php
+++ b/build/integration/features/bootstrap/FeatureContext.php
@@ -33,6 +33,7 @@ require __DIR__ . '/../../vendor/autoload.php';
* Features context.
*/
class FeatureContext implements Context, SnippetAcceptingContext {
+ use ContactsMenu;
use Search;
use WebDav;
}
diff --git a/build/integration/features/contacts-menu.feature b/build/integration/features/contacts-menu.feature
new file mode 100644
index 0000000000..845d4d3592
--- /dev/null
+++ b/build/integration/features/contacts-menu.feature
@@ -0,0 +1,188 @@
+Feature: contacts-menu
+
+ Scenario: users can be searched by display name
+ Given user "user0" exists
+ And user "user1" exists
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | displayname |
+ | value | Test name |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "Test name"
+
+ Scenario: users can be searched by email
+ Given user "user0" exists
+ And user "user1" exists
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | email |
+ | value | test@example.com |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "user1"
+
+ Scenario: users can not be searched by id
+ Given user "user0" exists
+ And user "user1" exists
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | displayname |
+ | value | Test name |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "user"
+ Then the list of searched contacts has "0" contacts
+
+ Scenario: search several users
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And user "user3" exists
+ And user "user4" exists
+ And user "user5" exists
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | displayname |
+ | value | Test name |
+ And sending "PUT" to "/cloud/users/user2" with
+ | key | email |
+ | value | test@example.com |
+ And sending "PUT" to "/cloud/users/user3" with
+ | key | displayname |
+ | value | Unmatched name |
+ And sending "PUT" to "/cloud/users/user4" with
+ | key | email |
+ | value | unmatched@example.com |
+ And sending "PUT" to "/cloud/users/user5" with
+ | key | displayname |
+ | value | Another test name |
+ And sending "PUT" to "/cloud/users/user5" with
+ | key | email |
+ | value | another_test@example.com |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "3" contacts
+ # Results are sorted alphabetically
+ And searched contact "0" is named "Another test name"
+ And searched contact "1" is named "Test name"
+ And searched contact "2" is named "user2"
+
+
+
+ Scenario: users can not be found by display name if visibility is private
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | displayname | Test name |
+ | displaynameScope | private |
+ And Logging in using web as "user2"
+ And Sending a "PUT" to "/settings/users/user2/settings" with requesttoken
+ | displayname | Another test name |
+ | displaynameScope | contacts |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "Another test name"
+
+ Scenario: users can not be found by email if visibility is private
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | email | test@example.com |
+ | emailScope | private |
+ And Logging in using web as "user2"
+ And Sending a "PUT" to "/settings/users/user2/settings" with requesttoken
+ | email | another_test@example.com |
+ | emailScope | contacts |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "user2"
+
+ Scenario: users can be found by other properties if the visibility of one is private
+ Given user "user0" exists
+ And user "user1" exists
+ And user "user2" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | displayname | Test name |
+ | displaynameScope | contacts |
+ | email | test@example.com |
+ | emailScope | private |
+ And Logging in using web as "user2"
+ And Sending a "PUT" to "/settings/users/user2/settings" with requesttoken
+ | displayname | Another test name |
+ | displaynameScope | private |
+ | email | another_test@example.com |
+ | emailScope | contacts |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "2" contacts
+ And searched contact "0" is named ""
+ And searched contact "1" is named "Test name"
+
+
+
+ Scenario: users can be searched by display name if visibility is increased again
+ Given user "user0" exists
+ And user "user1" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | displayname | Test name |
+ | displaynameScope | private |
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | displaynameScope | contacts |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "Test name"
+
+ Scenario: users can be searched by email if visibility is increased again
+ Given user "user0" exists
+ And user "user1" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | email | test@example.com |
+ | emailScope | private |
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | emailScope | contacts |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "1" contacts
+ And searched contact "0" is named "user1"
+
+
+
+ Scenario: users can not be searched by display name if visibility is private even if updated with provisioning
+ Given user "user0" exists
+ And user "user1" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | displaynameScope | private |
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | displayname |
+ | value | Test name |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "0" contacts
+
+ Scenario: users can not be searched by email if visibility is private even if updated with provisioning
+ Given user "user0" exists
+ And user "user1" exists
+ And Logging in using web as "user1"
+ And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
+ | emailScope | private |
+ And As an "admin"
+ And sending "PUT" to "/cloud/users/user1" with
+ | key | email |
+ | value | test@example.com |
+ When Logging in using web as "user0"
+ And searching for contacts matching with "test"
+ Then the list of searched contacts has "0" contacts