summaryrefslogtreecommitdiffstats
path: root/lib/private/Group/Group.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-20 11:33:02 +0200
committerJoas Schilling <coding@schilljs.com>2019-09-27 14:29:56 +0200
commit653628c8fb69dc3f9d26751520f91e43a18f17ae (patch)
treeef2dfb5f01bc19e09386364895ec9c8620ec3257 /lib/private/Group/Group.php
parent45506adc5c2a34a8c812a2a3c9273a8447b450af (diff)
downloadnextcloud-server-653628c8fb69dc3f9d26751520f91e43a18f17ae.tar.gz
nextcloud-server-653628c8fb69dc3f9d26751520f91e43a18f17ae.zip
Allow to set the group display name in the database backend
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Group/Group.php')
-rw-r--r--lib/private/Group/Group.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php
index a50a5ffde78..8d86425c8e5 100644
--- a/lib/private/Group/Group.php
+++ b/lib/private/Group/Group.php
@@ -33,6 +33,7 @@ namespace OC\Group;
use OCP\Group\Backend\IGetDisplayNameBackend;
use OCP\Group\Backend\IHideFromCollaborationBackend;
use OC\Hooks\PublicEmitter;
+use OCP\Group\Backend\ISetDisplayNameBackend;
use OCP\GroupInterface;
use OCP\IGroup;
use OCP\IUser;
@@ -101,6 +102,20 @@ class Group implements IGroup {
return $this->displayName;
}
+ public function setDisplayName(string $displayName): bool {
+ $displayName = trim($displayName);
+ if ($displayName !== '') {
+ foreach ($this->backends as $backend) {
+ if (($backend instanceof ISetDisplayNameBackend)
+ && $backend->setDisplayName($this->gid, $displayName)) {
+ $this->displayName = $displayName;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* get all users in the group
*