summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-07-06 22:51:06 +0200
committerGitHub <noreply@github.com>2022-07-06 22:51:06 +0200
commit744f1dd5638c7924be9c19621033d67991c65fd2 (patch)
tree9e1ccedcda433534195d5a98c0f8f9c065fc996e /apps/provisioning_api
parent72274cf0e9186f86187678e7247c9fe17ec0c947 (diff)
parenta0f5aebb89da4f18b37026e72e543bbe66b32980 (diff)
downloadnextcloud-server-744f1dd5638c7924be9c19621033d67991c65fd2.tar.gz
nextcloud-server-744f1dd5638c7924be9c19621033d67991c65fd2.zip
Merge pull request #33052 from nextcloud/fix/set-display-name
Do not send display name twice for saving
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php4
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php3
2 files changed, 5 insertions, 2 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index a26479ba0a8..839ac404c94 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -837,7 +837,9 @@ class UsersController extends AUserData {
switch ($key) {
case self::USER_FIELD_DISPLAYNAME:
case IAccountManager::PROPERTY_DISPLAYNAME:
- $targetUser->setDisplayName($value);
+ if (!$targetUser->setDisplayName($value)) {
+ throw new OCSException('Invalid displayname', 102);
+ }
break;
case self::USER_FIELD_QUOTA:
$quota = $value;
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 6162be54a04..4449302fedd 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -1486,7 +1486,8 @@ class UsersControllerTest extends TestCase {
$targetUser
->expects($this->once())
->method('setDisplayName')
- ->with('NewDisplayName');
+ ->with('NewDisplayName')
+ ->willReturn(true);
$targetUser
->expects($this->any())
->method('getUID')