Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-01-25 14:48:03 +0400
committerBjörn Schießle <schiessle@owncloud.com>2013-01-25 14:48:03 +0400
commit4271430e609be252d9b4a69fd7b3590571c14f7c (patch)
tree2c5c5bf9bf16e17a18488fcea6cc0f7f28e8aad2 /lib/group.php
parent9bb8e0583995fff244432bc34820127ef8ff6ac6 (diff)
get all display names from users in a given group
Diffstat (limited to 'lib/group.php')
-rw-r--r--lib/group.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/group.php b/lib/group.php
index ed9482418bd..8ebb698692b 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -286,4 +286,33 @@ class OC_Group {
}
return $users;
}
+
+ /**
+ * @brief get a list of all display names in a group
+ * @returns array with display names (key) and user ids(value)
+ */
+ public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
+ $displayNames=array();
+ foreach(self::$_usedBackends as $backend) {
+ $displayNames = array_merge($backend->displayNamesInGroup($gid, $search, $limit, $offset), $displayNames);
+ }
+ return $displayNames;
+ }
+
+ /**
+ * @brief get a list of all display names in several groups
+ * @param array $gids
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
+ * @return array with display names (Key) user ids (value)
+ */
+ public static function displayNamesInGroups($gids, $search = '', $limit = -1, $offset = 0) {
+ $displayNames = array();
+ foreach ($gids as $gid) {
+ // TODO Need to apply limits to groups as total
+ $displayNames = array_merge(array_diff(self::displayNamesInGroup($gid, $search, $limit, $offset), $displayNames), $displayNames);
+ }
+ return $displayNames;
+ }
}