Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2022-03-17 19:31:44 +0300
committerGitHub <noreply@github.com>2022-03-17 19:31:44 +0300
commit2a75c303b5ce01f809866a0afb326663b9f9d125 (patch)
tree2239f1537c728ad7455cf8e66353be5c72e44c81 /lib
parentec4be7f2be89dbd5fe99f7f3ea3f879739ffbea6 (diff)
parenta99d33c72d663252d540a7b4b02ef57577c53f3d (diff)
Merge pull request #31487 from nextcloud/enh/account-json-serialization
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/Account.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php
index 540d15cd4b9..7d36af561ce 100644
--- a/lib/private/Accounts/Account.php
+++ b/lib/private/Accounts/Account.php
@@ -104,9 +104,16 @@ class Account implements IAccount {
return $result;
}
- /** @return IAccountPropertyCollection[]|IAccountProperty[] */
+ /** @return array<string, IAccountProperty|array<int, IAccountProperty>> */
public function jsonSerialize(): array {
- return $this->properties;
+ $properties = $this->properties;
+ foreach ($properties as $propertyName => $propertyObject) {
+ if ($propertyObject instanceof IAccountPropertyCollection) {
+ // Override collection serialization to discard duplicate name
+ $properties[$propertyName] = $propertyObject->jsonSerialize()[$propertyName];
+ }
+ }
+ return $properties;
}
public function getUser(): IUser {