summaryrefslogtreecommitdiffstats
path: root/lib/private/group/group.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-04-04 18:56:14 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-04-08 12:04:38 +0200
commit698297feb3cb8e78c0e4adb6756e0ea98da49677 (patch)
treeb5138a46947af308d925742992a1c65b5d74ac29 /lib/private/group/group.php
parent411a810ebec9f3c6f99debab33098523d376d44d (diff)
downloadnextcloud-server-698297feb3cb8e78c0e4adb6756e0ea98da49677.tar.gz
nextcloud-server-698297feb3cb8e78c0e4adb6756e0ea98da49677.zip
add optional countUsersInGroup method to group backends
Diffstat (limited to 'lib/private/group/group.php')
-rw-r--r--lib/private/group/group.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/group/group.php b/lib/private/group/group.php
index 8d2aa87a788..9965d938ebb 100644
--- a/lib/private/group/group.php
+++ b/lib/private/group/group.php
@@ -187,6 +187,27 @@ class Group {
}
/**
+ * returns the number of users matching the search string
+ *
+ * @param string $search
+ * @return int | bool
+ */
+ public function count($search) {
+ $users = false;
+ foreach ($this->backends as $backend) {
+ if(method_exists($backend, 'countUsersInGroup')) {
+ if($users === false) {
+ //we could directly add to a bool variable, but this would
+ //be ugly
+ $users = 0;
+ }
+ $users += $backend->countUsersInGroup($this->gid, $search);
+ }
+ }
+ return $users;
+ }
+
+ /**
* search for users in the group by displayname
*
* @param string $search