diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2018-03-15 12:07:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 12:07:30 +0100 |
commit | 208e38e84e1a07a49699aa90dc5b7272d24489f0 (patch) | |
tree | 0a136997d2ba16d01c0a9ebc79ad67b550287cf5 /lib/private | |
parent | fde08a961941323b445f5b5eed10cf25199fb5b4 (diff) | |
parent | 23a1553539d67f7eb317abd3857640d056853d50 (diff) | |
download | nextcloud-server-208e38e84e1a07a49699aa90dc5b7272d24489f0.tar.gz nextcloud-server-208e38e84e1a07a49699aa90dc5b7272d24489f0.zip |
Merge pull request #8255 from nextcloud/bugfix/noid/group-display-name
Full implement group display names
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Group/Manager.php | 11 | ||||
-rw-r--r-- | lib/private/Group/MetaData.php | 2 | ||||
-rw-r--r-- | lib/private/Settings/Personal/PersonalInfo.php | 2 | ||||
-rw-r--r-- | lib/private/SubAdmin.php | 19 |
4 files changed, 28 insertions, 6 deletions
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 2d40b447996..1dd951a1078 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -330,6 +330,17 @@ class Manager extends PublicEmitter implements IGroupManager { } /** + * get an array of groupid and displayName for a user + * @param IUser $user + * @return array ['displayName' => displayname] + */ + public function getUserGroupNames(IUser $user) { + return array_map(function($group) { + return array('displayName' => $group->getDisplayName()); + }, $this->getUserGroups($user)); + } + + /** * get a list of all display names in a group * @param string $gid * @param string $search diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index d5c8b581f8b..99594301990 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -160,7 +160,7 @@ class MetaData { private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) { return array( 'id' => $group->getGID(), - 'name' => $group->getGID(), + 'name' => $group->getDisplayName(), 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, ); } diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php index 6411912513f..813d06195b5 100644 --- a/lib/private/Settings/Personal/PersonalInfo.php +++ b/lib/private/Settings/Personal/PersonalInfo.php @@ -174,7 +174,7 @@ class PersonalInfo implements ISettings { private function getGroups(IUser $user) { $groups = array_map( function(IGroup $group) { - return $group->getGID(); + return $group->getDisplayName(); }, $this->groupManager->getUserGroups($user) ); diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index cd16d07e43d..44d79d8994e 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -62,7 +62,7 @@ class SubAdmin extends PublicEmitter { $this->post_deleteUser($user); }); $this->groupManager->listen('\OC\Group', 'postDelete', function($group) { - $this->post_deleteGroup($group); + $this->post_deleteGroup($group); }); } @@ -123,7 +123,7 @@ class SubAdmin extends PublicEmitter { while($row = $result->fetch()) { $group = $this->groupManager->get($row['gid']); if(!is_null($group)) { - $groups[] = $group; + $groups[$group->getGID()] = $group; } } $result->closeCursor(); @@ -132,6 +132,17 @@ class SubAdmin extends PublicEmitter { } /** + * get an array of groupid and displayName for a user + * @param IUser $user + * @return array ['displayName' => displayname] + */ + public function getSubAdminsGroupsName(IUser $user) { + return array_map(function($group) { + return array('displayName' => $group->getDisplayName()); + }, $this->getSubAdminsGroups($user)); + } + + /** * get SubAdmins of a group * @param IGroup $group the group * @return IUser[] @@ -185,7 +196,7 @@ class SubAdmin extends PublicEmitter { /** * checks if a user is a SubAdmin of a group - * @param IUser $user + * @param IUser $user * @param IGroup $group * @return bool */ @@ -210,7 +221,7 @@ class SubAdmin extends PublicEmitter { /** * checks if a user is a SubAdmin - * @param IUser $user + * @param IUser $user * @return bool */ public function isSubAdmin(IUser $user) { |