diff options
author | Pytal <24800714+Pytal@users.noreply.github.com> | 2022-03-17 09:31:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-17 09:31:44 -0700 |
commit | 2a75c303b5ce01f809866a0afb326663b9f9d125 (patch) | |
tree | 2239f1537c728ad7455cf8e66353be5c72e44c81 /lib | |
parent | ec4be7f2be89dbd5fe99f7f3ea3f879739ffbea6 (diff) | |
parent | a99d33c72d663252d540a7b4b02ef57577c53f3d (diff) | |
download | nextcloud-server-2a75c303b5ce01f809866a0afb326663b9f9d125.tar.gz nextcloud-server-2a75c303b5ce01f809866a0afb326663b9f9d125.zip |
Merge pull request #31487 from nextcloud/enh/account-json-serialization
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Accounts/Account.php | 11 |
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 { |