Merge pull request #26398 from nextcloud/backport/26394/stable21
[stable21] Allow apps to write/update account data
This commit is contained in:
commit
e0dcf642de
|
@ -510,4 +510,18 @@ class AccountManager implements IAccountManager {
|
||||||
public function getAccount(IUser $user): IAccount {
|
public function getAccount(IUser $user): IAccount {
|
||||||
return $this->parseAccountData($user, $this->getUser($user));
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,16 @@ interface IAccountManager {
|
||||||
*/
|
*/
|
||||||
public function getAccount(IUser $user): IAccount;
|
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
|
* Search for users based on account data
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue