summaryrefslogtreecommitdiffstats
path: root/lib/user
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-30 20:20:46 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-11 16:25:27 -0400
commit8d1eb674ec37651aa8b67eec51de6a9f08523fd9 (patch)
tree8f90e49d7031859d568750977a3949325a0679bb /lib/user
parentbaa0b4d530db8a585692c222d5f5cf185438c68a (diff)
downloadnextcloud-server-8d1eb674ec37651aa8b67eec51de6a9f08523fd9.tar.gz
nextcloud-server-8d1eb674ec37651aa8b67eec51de6a9f08523fd9.zip
Add search, limit, and offset parameters to getUsers() and getGroups()
Diffstat (limited to 'lib/user')
-rw-r--r--lib/user/backend.php2
-rw-r--r--lib/user/database.php13
-rw-r--r--lib/user/interface.php2
3 files changed, 8 insertions, 9 deletions
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