aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Accounts
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-03-08 00:38:38 +0000
committerChristopher Ng <chrng8@gmail.com>2022-03-17 04:27:39 +0000
commita99d33c72d663252d540a7b4b02ef57577c53f3d (patch)
treeb3db0499dead746d4095c1dc3481529832f82fd7 /lib/private/Accounts
parentd9c079937726bfa37a48ef8a2f206741f3fa12e3 (diff)
downloadnextcloud-server-a99d33c72d663252d540a7b4b02ef57577c53f3d.tar.gz
nextcloud-server-a99d33c72d663252d540a7b4b02ef57577c53f3d.zip
Discard duplicate collection name from account serialization
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/Accounts')
-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 {