diff options
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r-- | apps/user_ldap/lib/access.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index e7fb4165c36..f38d11d4be3 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -596,6 +596,22 @@ class Access extends LDAPUtility implements user\IUserTools { } /** + * fetches a list of users according to a provided loginName and utilizing + * the login filter. + * + * @param string $loginName + * @param array $attributes optional, list of attributes to read + * @return array + */ + public function fetchUsersByLoginName($loginName, $attributes = array('dn')) { + $loginName = $this->escapeFilterPart($loginName); + $filter = \OCP\Util::mb_str_replace( + '%uid', $loginName, $this->connection->ldapLoginFilter, 'UTF-8'); + $users = $this->fetchListOfUsers($filter, $attributes); + return $users; + } + + /** * @param string $filter * @param string|string[] $attr * @param int $limit @@ -687,6 +703,17 @@ class Access extends LDAPUtility implements user\IUserTools { } /** + * returns the number of available objects on the base DN + * + * @param int|null $limit + * @param int|null $offset + * @return int|bool + */ + public function countObjects($limit = null, $offset = null) { + return $this->count('objectclass=*', $this->connection->ldapBase, array('dn'), $limit, $offset); + } + + /** * retrieved. Results will according to the order in the array. * @param int $limit optional, maximum results to be counted * @param int $offset optional, a starting point |