aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Accounts/AccountProperty.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Accounts/AccountProperty.php')
-rw-r--r--lib/private/Accounts/AccountProperty.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php
index 97f9b1c356f..4c75ad85414 100644
--- a/lib/private/Accounts/AccountProperty.php
+++ b/lib/private/Accounts/AccountProperty.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OC\Accounts;
+use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
class AccountProperty implements IAccountProperty {
@@ -42,7 +43,7 @@ class AccountProperty implements IAccountProperty {
public function __construct(string $name, string $value, string $scope, string $verified) {
$this->name = $name;
$this->value = $value;
- $this->scope = $scope;
+ $this->scope = $this->mapScopeToV2($scope);
$this->verified = $verified;
}
@@ -77,7 +78,7 @@ class AccountProperty implements IAccountProperty {
* @return IAccountProperty
*/
public function setScope(string $scope): IAccountProperty {
- $this->scope = $scope;
+ $this->scope = $this->mapScopeToV2($scope);
return $this;
}
@@ -127,6 +128,23 @@ class AccountProperty implements IAccountProperty {
return $this->scope;
}
+ private function mapScopeToV2($scope) {
+ if (strpos($scope, 'v2-') === 0) {
+ return $scope;
+ }
+
+ switch ($scope) {
+ case IAccountManager::VISIBILITY_PRIVATE:
+ return IAccountManager::SCOPE_LOCAL;
+ case IAccountManager::VISIBILITY_CONTACTS_ONLY:
+ return IAccountManager::SCOPE_FEDERATED;
+ case IAccountManager::VISIBILITY_PUBLIC:
+ return IAccountManager::SCOPE_PUBLISHED;
+ }
+
+ return IAccountManager::SCOPE_LOCAL;
+ }
+
/**
* Get the verification status of a property
*