summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/group.php8
-rw-r--r--lib/group/backend.php2
-rw-r--r--lib/group/database.php12
-rw-r--r--lib/group/interface.php2
-rw-r--r--lib/public/user.php2
-rw-r--r--lib/user.php12
-rw-r--r--lib/user/backend.php2
-rw-r--r--lib/user/database.php13
-rw-r--r--lib/user/interface.php2
9 files changed, 26 insertions, 29 deletions
diff --git a/lib/group.php b/lib/group.php
index 7b137f0f8f1..a3bdbf9e003 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -237,10 +237,10 @@ class OC_Group {
*
* Returns a list with all groups
*/
- public static function getGroups(){
- $groups=array();
- foreach(self::$_usedBackends as $backend){
- $groups=array_merge($backend->getGroups(),$groups);
+ public static function getGroups($search = '', $limit = 10, $offset = 0) {
+ $groups = array();
+ foreach (self::$_usedBackends as $backend) {
+ $groups = array_merge($backend->getGroups($search, $limit, $offset), $groups);
}
asort($groups);
return $groups;
diff --git a/lib/group/backend.php b/lib/group/backend.php
index ebc078f152a..3f2909caa15 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -105,7 +105,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
*
* Returns a list with all groups
*/
- public function getGroups(){
+ public function getGroups($search = '', $limit = 10, $offset = 0) {
return array();
}
diff --git a/lib/group/database.php b/lib/group/database.php
index 2770ec185c4..6314a127438 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -164,15 +164,13 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Returns a list with all groups
*/
- public function getGroups(){
- $query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups`" );
- $result = $query->execute();
-
+ public function getGroups($search = '', $limit = 10, $offset = 0) {
+ $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()){
- $groups[] = $row["gid"];
+ while ($row = $result->fetchRow()) {
+ $groups[] = $row['gid'];
}
-
return $groups;
}
diff --git a/lib/group/interface.php b/lib/group/interface.php
index 7cca6061e10..6e492e72748 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();
+ public function getGroups($search = '', $limit = 10, $offset = 0);
/**
* check if a group exists
diff --git a/lib/public/user.php b/lib/public/user.php
index 713e366b968..178d1dddd36 100644
--- a/lib/public/user.php
+++ b/lib/public/user.php
@@ -51,7 +51,7 @@ class User {
*
* Get a list of all users.
*/
- public static function getUsers(){
+ public static function getUsers($search = '', $limit = 10, $offset = 0) {
return \OC_USER::getUsers();
}
diff --git a/lib/user.php b/lib/user.php
index 49a0a2a10ce..95177bc77de 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -338,12 +338,12 @@ class OC_User {
*
* Get a list of all users.
*/
- public static function getUsers(){
- $users=array();
- foreach(self::$_usedBackends as $backend){
- $backendUsers=$backend->getUsers();
- if(is_array($backendUsers)){
- $users=array_merge($users,$backendUsers);
+ public static function getUsers($search = '', $limit = 10, $offset = 0) {
+ $users = array();
+ foreach (self::$_usedBackends as $backend) {
+ $backendUsers = $backend->getUsers($search, $limit, $offset);
+ if (is_array($backendUsers)) {
+ $users = array_merge($users, $backendUsers);
}
}
asort($users);
diff --git a/lib/user/backend.php b/lib/user/backend.php
index daa942d261c..ff00ef08f6c 100644
--- a/lib/user/backend.php
+++ b/lib/user/backend.php
@@ -97,7 +97,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
*
* Get a list of all users.
*/
- public function getUsers(){
+ public function getUsers($search = '', $limit = 10, $offset = 0) {
return array();
}
diff --git a/lib/user/database.php b/lib/user/database.php
index cc27b3ddbfd..968814d9d57 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -154,13 +154,12 @@ class OC_User_Database extends OC_User_Backend {
*
* Get a list of all users.
*/
- public function getUsers(){
- $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users" );
- $result = $query->execute();
-
- $users=array();
- while( $row = $result->fetchRow()){
- $users[] = $row["uid"];
+ public function getUsers($search = '', $limit = 10, $offset = 0) {
+ $query = OC_DB::prepare('SELECT uid FROM *PREFIX*users WHERE uid LIKE ? LIMIT '.$limit.' OFFSET '.$offset);
+ $result = $query->execute(array($search.'%'));
+ $users = array();
+ while ($row = $result->fetchRow()) {
+ $users[] = $row['uid'];
}
return $users;
}
diff --git a/lib/user/interface.php b/lib/user/interface.php
index dc3685dc20d..b3286cd2f9e 100644
--- a/lib/user/interface.php
+++ b/lib/user/interface.php
@@ -48,7 +48,7 @@ interface OC_User_Interface {
*
* Get a list of all users.
*/
- public function getUsers();
+ public function getUsers($search = '', $limit = 10, $offset = 0);
/**
* @brief check if a user exists