diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 6198f8dbddd9a..7b08fa3e598c4 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -510,4 +510,18 @@ private function parseAccountData(IUser $user, $data): Account { public function getAccount(IUser $user): IAccount { return $this->parseAccountData($user, $this->getUser($user)); } + + public function updateAccount(IAccount $account): void { + $data = []; + + foreach ($account->getProperties() as $property) { + $data[$property->getName()] = [ + 'value' => $property->getValue(), + 'scope' => $property->getScope(), + 'verified' => $property->getVerified(), + ]; + } + + $this->updateUser($account->getUser(), $data, true); + } } diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php index e88fd32f6741e..63fbc9ba312ee 100644 --- a/lib/public/Accounts/IAccountManager.php +++ b/lib/public/Accounts/IAccountManager.php @@ -110,6 +110,16 @@ interface IAccountManager { */ public function getAccount(IUser $user): IAccount; + /** + * Update the account data with for the user + * + * @since 21.0.1 + * + * @param IAccount $account + * @throws \InvalidArgumentException Message is the property that was invalid + */ + public function updateAccount(IAccount $account): void; + /** * Search for users based on account data *