summaryrefslogtreecommitdiffstats
path: root/lib/group
diff options
context:
space:
mode:
Diffstat (limited to 'lib/group')
-rw-r--r--lib/group/backend.php5
-rw-r--r--lib/group/database.php24
-rw-r--r--lib/group/dummy.php4
-rw-r--r--lib/group/example.php4
-rw-r--r--lib/group/interface.php4
5 files changed, 25 insertions, 16 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 73fc402a9ab..5969986c652 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -105,7 +105,8 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0) {
+
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
return array();
}
@@ -122,7 +123,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 b989f6ae028..0b4ae393cf1 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -164,8 +164,12 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0) {
- $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
+ if ($limit == -1) {
+ $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ?');
+ } else {
+ $query = OC_DB::prepare('SELECT gid FROM *PREFIX*groups WHERE gid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ }
$result = $query->execute(array($search.'%'));
$groups = array();
while ($row = $result->fetchRow()) {
@@ -192,12 +196,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 1243891023f..51eca28f3f4 100644
--- a/lib/group/dummy.php
+++ b/lib/group/dummy.php
@@ -141,7 +141,7 @@ class OC_Group_Dummy extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups(){
+ public function getGroups($search = '', $limit = -1, $offset = 0) {
return array_keys($this->groups);
}
@@ -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 9c9ece5ac77..76d12629763 100644
--- a/lib/group/example.php
+++ b/lib/group/example.php
@@ -91,7 +91,7 @@ abstract class OC_Group_Example {
*
* Returns a list with all groups
*/
- abstract public static function getGroups();
+ abstract public static function getGroups($search = '', $limit = -1, $offset = 0);
/**
* check if a group exists
@@ -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 6e492e72748..12cc07a5374 100644
--- a/lib/group/interface.php
+++ b/lib/group/interface.php
@@ -58,7 +58,7 @@ interface OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups($search = '', $limit = 10, $offset = 0);
+ public function getGroups($search = '', $limit = -1, $offset = 0);
/**
* check if a group exists
@@ -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