summaryrefslogtreecommitdiffstats
path: root/lib/group
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-11 16:21:09 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-11 16:25:28 -0400
commita1c88a3e39695a463ff7d0dda74dbdbb59d86f5c (patch)
tree39cefd2a127bababa2b548467b09f75b2b9dd616 /lib/group
parent4f1b3631ba3356fb3890180b65281b9653a0e714 (diff)
downloadnextcloud-server-a1c88a3e39695a463ff7d0dda74dbdbb59d86f5c.tar.gz
nextcloud-server-a1c88a3e39695a463ff7d0dda74dbdbb59d86f5c.zip
Add search, limit, offset parameters to usersInGroups()
Diffstat (limited to 'lib/group')
-rw-r--r--lib/group/backend.php2
-rw-r--r--lib/group/database.php16
-rw-r--r--lib/group/dummy.php2
-rw-r--r--lib/group/example.php2
-rw-r--r--lib/group/interface.php2
5 files changed, 14 insertions, 10 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 7a7cebc726f..4c7d09bcb16 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -122,7 +122,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
return array();
}
diff --git a/lib/group/database.php b/lib/group/database.php
index 669edc662cc..1cb4171f49f 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -182,12 +182,16 @@ class OC_Group_Database extends OC_Group_Backend {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
- $query=OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid=?');
- $users=array();
- $result=$query->execute(array($gid));
- while($row=$result->fetchRow()){
- $users[]=$row['uid'];
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
+ if ($limit == -1) {
+ $query = OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid = ? AND uid LIKE ?');
+ } else {
+ $query = OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid = ? AND uid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ }
+ $result = $query->execute(array($gid, $search.'%'));
+ $users = array();
+ while ($row = $result->fetchRow()) {
+ $users[] = $row['uid'];
}
return $users;
}
diff --git a/lib/group/dummy.php b/lib/group/dummy.php
index 092aa9beda8..51eca28f3f4 100644
--- a/lib/group/dummy.php
+++ b/lib/group/dummy.php
@@ -149,7 +149,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid){
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
if(isset($this->groups[$gid])){
return $this->groups[$gid];
}else{
diff --git a/lib/group/example.php b/lib/group/example.php
index c33b435ca05..76d12629763 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -104,6 +104,6 @@ abstract class OC_Group_Example {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- abstract public static function usersInGroup($gid);
+ abstract public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
}
diff --git a/lib/group/interface.php b/lib/group/interface.php
index f496d502df6..12cc07a5374 100644
--- a/lib/group/interface.php
+++ b/lib/group/interface.php
@@ -71,6 +71,6 @@ interface OC_Group_Interface {
* @brief get a list of all users in a group
* @returns array with user ids
*/
- public function usersInGroup($gid);
+ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
} \ No newline at end of file