From 77f7da99215aa0625c0091d97e288fecfaff07b0 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 10 Feb 2023 21:52:49 +0100 Subject: [PATCH] Always set displayname and display-name for user data Signed-off-by: jld3103 --- apps/provisioning_api/lib/Controller/AUserData.php | 2 ++ apps/provisioning_api/lib/Controller/UsersController.php | 5 +---- lib/public/Accounts/IAccountManager.php | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 108d24576d96a..bbb3abe3c24ac 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -12,6 +12,7 @@ * @author John Molakvoæ * @author Roeland Jago Douma * @author Vincent Petry + * @author Kate Döen * * @license GNU AGPL version 3 or any later version * @@ -175,6 +176,7 @@ protected function getUserData(string $userId, bool $includeScopes = false): arr } $data[IAccountManager::PROPERTY_DISPLAYNAME] = $targetUserObject->getDisplayName(); + $data[IAccountManager::PROPERTY_DISPLAYNAME_LEGACY] = $data[IAccountManager::PROPERTY_DISPLAYNAME]; if ($includeScopes) { $data[IAccountManager::PROPERTY_DISPLAYNAME . self::SCOPE_SUFFIX] = $userAccount->getProperty(IAccountManager::PROPERTY_DISPLAYNAME)->getScope(); } diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 97d66acd2e0bb..f5bbf4899a4d1 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -24,6 +24,7 @@ * @author Thomas Müller * @author Tom Needham * @author Vincent Petry + * @author Kate Döen * * @license AGPL-3.0 * @@ -546,10 +547,6 @@ public function getCurrentUser(): DataResponse { $user = $this->userSession->getUser(); if ($user) { $data = $this->getUserData($user->getUID(), true); - // rename "displayname" to "display-name" only for this call to keep - // the API stable. - $data['display-name'] = $data['displayname']; - unset($data['displayname']); return new DataResponse($data); } diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php index 7c977b575ae78..68eca469ad9c9 100644 --- a/lib/public/Accounts/IAccountManager.php +++ b/lib/public/Accounts/IAccountManager.php @@ -10,6 +10,7 @@ * @author Julius Härtl * @author Thomas Citharel * @author Vincent Petry + * @author Kate Döen * * @license GNU AGPL version 3 or any later version * @@ -106,6 +107,7 @@ interface IAccountManager { public const PROPERTY_AVATAR = 'avatar'; public const PROPERTY_DISPLAYNAME = 'displayname'; + public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name'; public const PROPERTY_PHONE = 'phone'; public const PROPERTY_EMAIL = 'email'; public const PROPERTY_WEBSITE = 'website';