diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-01-08 12:07:57 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-01-08 12:07:57 +0100 |
commit | b669e1a3c13dc6fabc8929a4abc4fd13fb8a4450 (patch) | |
tree | 1f4e9e9cb450be5e832c9dc6b5fcc6007a277eb5 /apps/user_ldap/user_ldap.php | |
parent | bc1235d325c5b8ff659afc6700e82e35e2912fbb (diff) | |
download | nextcloud-server-b669e1a3c13dc6fabc8929a4abc4fd13fb8a4450.tar.gz nextcloud-server-b669e1a3c13dc6fabc8929a4abc4fd13fb8a4450.zip |
LDAP: implement userCount action. This required to (finally) clean up and refactor the search method, which will have a positive performance impact on paged search.
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rw-r--r-- | apps/user_ldap/user_ldap.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 527a5c10b85..542d6b00c51 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -363,7 +363,8 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { return (bool)((OC_USER_BACKEND_CHECK_PASSWORD | OC_USER_BACKEND_GET_HOME | OC_USER_BACKEND_GET_DISPLAYNAME - | OC_USER_BACKEND_PROVIDE_AVATAR) + | OC_USER_BACKEND_PROVIDE_AVATAR + | OC_USER_BACKEND_COUNT_USERS) & $actions); } @@ -373,4 +374,17 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { public function hasUserListings() { return true; } + + /** + * counts the users in LDAP + * + * @return int | bool + */ + public function countUsers() { + $o = $this->access->connection->ldapLoginFilter; + $filter = \OCP\Util::mb_str_replace( + '%uid', '*', $this->access->connection->ldapLoginFilter, 'UTF-8'); + $entries = $this->access->countUsers($filter); + return $entries; + } } |