mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #52544 from nextcloud/chore/drop-deprecated-account-scopes
This commit is contained in:
commit
ae63945736
6 changed files with 19 additions and 90 deletions
|
|
@ -71,8 +71,6 @@ Feature: contacts-menu
|
|||
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
|
||||
|
|
@ -80,11 +78,11 @@ Feature: contacts-menu
|
|||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| displayname | Test name |
|
||||
| displaynameScope | private |
|
||||
| displaynameScope | v2-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 |
|
||||
| displaynameScope | v2-federated |
|
||||
When Logging in using web as "user0"
|
||||
And searching for contacts matching with "test"
|
||||
# Disabled because it regularly fails on drone:
|
||||
|
|
@ -98,11 +96,11 @@ Feature: contacts-menu
|
|||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| email | test@example.com |
|
||||
| emailScope | private |
|
||||
| emailScope | v2-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 |
|
||||
| emailScope | v2-federated |
|
||||
# Disabled because it regularly fails on drone:
|
||||
# When Logging in using web as "user0"
|
||||
# And searching for contacts matching with "test"
|
||||
|
|
@ -116,15 +114,15 @@ Feature: contacts-menu
|
|||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| displayname | Test name |
|
||||
| displaynameScope | contacts |
|
||||
| displaynameScope | v2-federated |
|
||||
| email | test@example.com |
|
||||
| emailScope | private |
|
||||
| emailScope | v2-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 |
|
||||
| displaynameScope | v2-private |
|
||||
| email | another_test@example.com |
|
||||
| emailScope | contacts |
|
||||
| emailScope | v2-federated |
|
||||
When Logging in using web as "user0"
|
||||
And searching for contacts matching with "test"
|
||||
Then the list of searched contacts has "2" contacts
|
||||
|
|
@ -140,9 +138,9 @@ Feature: contacts-menu
|
|||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| displayname | Test name |
|
||||
| displaynameScope | private |
|
||||
| displaynameScope | v2-private |
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| displaynameScope | contacts |
|
||||
| displaynameScope | v2-federated |
|
||||
When Logging in using web as "user0"
|
||||
And searching for contacts matching with "test"
|
||||
Then the list of searched contacts has "1" contacts
|
||||
|
|
@ -154,9 +152,9 @@ Feature: contacts-menu
|
|||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| email | test@example.com |
|
||||
| emailScope | private |
|
||||
| emailScope | v2-private |
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| emailScope | contacts |
|
||||
| emailScope | v2-federated |
|
||||
# Disabled because it regularly fails on drone:
|
||||
# When Logging in using web as "user0"
|
||||
# And searching for contacts matching with "test"
|
||||
|
|
@ -170,7 +168,7 @@ Feature: contacts-menu
|
|||
And user "user1" exists
|
||||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| displaynameScope | private |
|
||||
| displaynameScope | v2-private |
|
||||
And As an "admin"
|
||||
And sending "PUT" to "/cloud/users/user1" with
|
||||
| key | displayname |
|
||||
|
|
@ -185,7 +183,7 @@ Feature: contacts-menu
|
|||
And user "user1" exists
|
||||
And Logging in using web as "user1"
|
||||
And Sending a "PUT" to "/settings/users/user1/settings" with requesttoken
|
||||
| emailScope | private |
|
||||
| emailScope | v2-private |
|
||||
And As an "admin"
|
||||
And sending "PUT" to "/cloud/users/user1" with
|
||||
| key | email |
|
||||
|
|
|
|||
|
|
@ -210,21 +210,6 @@ Feature: provisioning
|
|||
| value | v2-published |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
When sending "PUT" to "/cloud/users/brand-new-user" with
|
||||
| key | websiteScope |
|
||||
| value | public |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
When sending "PUT" to "/cloud/users/brand-new-user" with
|
||||
| key | displaynameScope |
|
||||
| value | contacts |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
When sending "PUT" to "/cloud/users/brand-new-user" with
|
||||
| key | avatarScope |
|
||||
| value | private |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And sending "PUT" to "/cloud/users/brand-new-user" with
|
||||
| key | email |
|
||||
| value | no-reply@nextcloud.com |
|
||||
|
|
@ -253,9 +238,6 @@ Feature: provisioning
|
|||
| twitterScope | v2-local |
|
||||
| addressScope | v2-federated |
|
||||
| emailScope | v2-published |
|
||||
| websiteScope | v2-published |
|
||||
| displaynameScope | v2-federated |
|
||||
| avatarScope | v2-local |
|
||||
|
||||
Scenario: Edit a user account multivalue property scopes
|
||||
Given user "brand-new-user" exists
|
||||
|
|
|
|||
|
|
@ -131,9 +131,7 @@ class AccountManager implements IAccountManager {
|
|||
$property->setScope(self::SCOPE_LOCAL);
|
||||
}
|
||||
} else {
|
||||
// migrate scope values to the new format
|
||||
// invalid scopes are mapped to a default value
|
||||
$property->setScope(AccountProperty::mapScopeToV2($property->getScope()));
|
||||
$property->setScope($property->getScope());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,16 +55,11 @@ class AccountProperty implements IAccountProperty {
|
|||
* @since 15.0.0
|
||||
*/
|
||||
public function setScope(string $scope): IAccountProperty {
|
||||
$newScope = $this->mapScopeToV2($scope);
|
||||
if (!in_array($newScope, [
|
||||
IAccountManager::SCOPE_LOCAL,
|
||||
IAccountManager::SCOPE_FEDERATED,
|
||||
IAccountManager::SCOPE_PRIVATE,
|
||||
IAccountManager::SCOPE_PUBLISHED
|
||||
])) {
|
||||
if (!in_array($scope, IAccountManager::ALLOWED_SCOPES, )) {
|
||||
throw new InvalidArgumentException('Invalid scope');
|
||||
}
|
||||
$this->scope = $newScope;
|
||||
/** @var IAccountManager::SCOPE_* $scope */
|
||||
$this->scope = $scope;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -105,19 +100,6 @@ class AccountProperty implements IAccountProperty {
|
|||
return $this->scope;
|
||||
}
|
||||
|
||||
public static function mapScopeToV2(string $scope): string {
|
||||
if (str_starts_with($scope, 'v2-')) {
|
||||
return $scope;
|
||||
}
|
||||
|
||||
return match ($scope) {
|
||||
IAccountManager::VISIBILITY_PRIVATE, '' => IAccountManager::SCOPE_LOCAL,
|
||||
IAccountManager::VISIBILITY_CONTACTS_ONLY => IAccountManager::SCOPE_FEDERATED,
|
||||
IAccountManager::VISIBILITY_PUBLIC => IAccountManager::SCOPE_PUBLISHED,
|
||||
default => $scope,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verification status of a property
|
||||
*
|
||||
|
|
|
|||
|
|
@ -47,30 +47,6 @@ interface IAccountManager {
|
|||
*/
|
||||
public const SCOPE_PUBLISHED = 'v2-published';
|
||||
|
||||
/**
|
||||
* Contact details only visible locally
|
||||
*
|
||||
* @since 15.0.0
|
||||
* @deprecated 21.0.1
|
||||
*/
|
||||
public const VISIBILITY_PRIVATE = 'private';
|
||||
|
||||
/**
|
||||
* Contact details visible on trusted federated servers.
|
||||
*
|
||||
* @since 15.0.0
|
||||
* @deprecated 21.0.1
|
||||
*/
|
||||
public const VISIBILITY_CONTACTS_ONLY = 'contacts';
|
||||
|
||||
/**
|
||||
* Contact details visible on trusted federated servers and in the public lookup server.
|
||||
*
|
||||
* @since 15.0.0
|
||||
* @deprecated 21.0.1
|
||||
*/
|
||||
public const VISIBILITY_PUBLIC = 'public';
|
||||
|
||||
/**
|
||||
* The list of allowed scopes
|
||||
*
|
||||
|
|
@ -81,9 +57,6 @@ interface IAccountManager {
|
|||
self::SCOPE_LOCAL,
|
||||
self::SCOPE_FEDERATED,
|
||||
self::SCOPE_PUBLISHED,
|
||||
self::VISIBILITY_PRIVATE,
|
||||
self::VISIBILITY_CONTACTS_ONLY,
|
||||
self::VISIBILITY_PUBLIC,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -98,6 +71,7 @@ interface IAccountManager {
|
|||
|
||||
/**
|
||||
* @since 27.0.0
|
||||
* @deprecated 27.0.0 only added for backwards compatibility with provisioning_api UsersController::getCurrentUser
|
||||
*/
|
||||
public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name';
|
||||
|
||||
|
|
|
|||
|
|
@ -63,11 +63,6 @@ class AccountPropertyTest extends TestCase {
|
|||
[IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_LOCAL],
|
||||
[IAccountManager::SCOPE_FEDERATED, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::SCOPE_PUBLISHED, IAccountManager::SCOPE_PUBLISHED],
|
||||
// legacy values
|
||||
[IAccountManager::VISIBILITY_PRIVATE, IAccountManager::SCOPE_LOCAL],
|
||||
[IAccountManager::VISIBILITY_CONTACTS_ONLY, IAccountManager::SCOPE_FEDERATED],
|
||||
[IAccountManager::VISIBILITY_PUBLIC, IAccountManager::SCOPE_PUBLISHED],
|
||||
['', IAccountManager::SCOPE_LOCAL],
|
||||
// invalid values
|
||||
['unknown', null],
|
||||
['v2-unknown', null],
|
||||
|
|
|
|||
Loading…
Reference in a new issue