summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2021-05-25 21:22:37 +0200
committerGitHub <noreply@github.com>2021-05-25 21:22:37 +0200
commit1b47886abb85d97fd6825db6c4edef3fbd278881 (patch)
treec4b8389196b5a9adde015f24e941a542a4ce0cc3 /lib
parent3d1c78647e2dcc9c3ca2dcad28f39a2b7e5bc589 (diff)
parent847ed37afcc2b00f8dcf9ffc9f2f0671a3539bd4 (diff)
downloadnextcloud-server-1b47886abb85d97fd6825db6c4edef3fbd278881.tar.gz
nextcloud-server-1b47886abb85d97fd6825db6c4edef3fbd278881.zip
Merge pull request #27035 from nextcloud/techdebt/26866/userscontroller-accountmanager-api
do not use private AccountManager in UsersController
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/Account.php4
-rw-r--r--lib/private/Accounts/AccountProperty.php17
-rw-r--r--lib/public/Accounts/IAccount.php5
-rw-r--r--lib/public/Accounts/IAccountProperty.php14
4 files changed, 34 insertions, 6 deletions
diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php
index e7aeb6fa1e9..109691641fd 100644
--- a/lib/private/Accounts/Account.php
+++ b/lib/private/Accounts/Account.php
@@ -44,8 +44,8 @@ class Account implements IAccount {
$this->user = $user;
}
- public function setProperty(string $property, string $value, string $scope, string $verified): IAccount {
- $this->properties[$property] = new AccountProperty($property, $value, $scope, $verified);
+ public function setProperty(string $property, string $value, string $scope, string $verified, string $verificationData = ''): IAccount {
+ $this->properties[$property] = new AccountProperty($property, $value, $scope, $verified, $verificationData);
return $this;
}
diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php
index 0152137f6de..cb60a7c6940 100644
--- a/lib/private/Accounts/AccountProperty.php
+++ b/lib/private/Accounts/AccountProperty.php
@@ -39,12 +39,15 @@ class AccountProperty implements IAccountProperty {
private $scope;
/** @var string */
private $verified;
+ /** @var string */
+ private $verificationData;
- public function __construct(string $name, string $value, string $scope, string $verified) {
+ public function __construct(string $name, string $value, string $scope, string $verified, string $verificationData) {
$this->name = $name;
$this->value = $value;
$this->setScope($scope);
$this->verified = $verified;
+ $this->verificationData = $verificationData;
}
public function jsonSerialize() {
@@ -52,7 +55,8 @@ class AccountProperty implements IAccountProperty {
'name' => $this->getName(),
'value' => $this->getValue(),
'scope' => $this->getScope(),
- 'verified' => $this->getVerified()
+ 'verified' => $this->getVerified(),
+ 'verificationData' => $this->getVerificationData(),
];
}
@@ -164,4 +168,13 @@ class AccountProperty implements IAccountProperty {
public function getVerified(): string {
return $this->verified;
}
+
+ public function setVerificationData(string $verificationData): IAccountProperty {
+ $this->verificationData = $verificationData;
+ return $this;
+ }
+
+ public function getVerificationData(): string {
+ return $this->verificationData;
+ }
}
diff --git a/lib/public/Accounts/IAccount.php b/lib/public/Accounts/IAccount.php
index 3f8c86cbc1a..7397eb4fea8 100644
--- a/lib/public/Accounts/IAccount.php
+++ b/lib/public/Accounts/IAccount.php
@@ -44,9 +44,10 @@ interface IAccount extends \JsonSerializable {
* @param string $value
* @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager
* @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED
+ * @param string $verificationData Optional, defaults to empty string. Since @22.0.0.
* @return IAccount
*/
- public function setProperty(string $property, string $value, string $scope, string $verified): IAccount;
+ public function setProperty(string $property, string $value, string $scope, string $verified, string $verificationData = ''): IAccount;
/**
* Get a property by its key
@@ -60,7 +61,7 @@ interface IAccount extends \JsonSerializable {
public function getProperty(string $property): IAccountProperty;
/**
- * Get all properties of an account
+ * Get all properties of an account. Array indices are property names.
*
* @since 15.0.0
*
diff --git a/lib/public/Accounts/IAccountProperty.php b/lib/public/Accounts/IAccountProperty.php
index 1366ddd9543..dcc81f02cac 100644
--- a/lib/public/Accounts/IAccountProperty.php
+++ b/lib/public/Accounts/IAccountProperty.php
@@ -101,4 +101,18 @@ interface IAccountProperty extends \JsonSerializable {
* @return string
*/
public function getVerified(): string;
+
+ /**
+ * Sets data for verification purposes.
+ *
+ * @since 22.0.0
+ */
+ public function setVerificationData(string $verificationData): IAccountProperty;
+
+ /**
+ * Retrieves data for verification purposes.
+ *
+ * @since 22.0.0
+ */
+ public function getVerificationData(): string;
}