diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-06 14:48:59 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-06 14:48:59 -0500 |
commit | 70c65268fe017014b97dbc18e02588b8ed1d9a19 (patch) | |
tree | d843b97b1458e696f7e9e993295e5961cc06903d /app/Core/Ldap/User.php | |
parent | 6d4286ec664f1df8b0e97b759075afbf34d9620a (diff) |
Update plugin doc
Diffstat (limited to 'app/Core/Ldap/User.php')
-rw-r--r-- | app/Core/Ldap/User.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/app/Core/Ldap/User.php b/app/Core/Ldap/User.php index ab8d7296..0c9df63f 100644 --- a/app/Core/Ldap/User.php +++ b/app/Core/Ldap/User.php @@ -34,18 +34,18 @@ class User } /** - * Get user profile (helper) + * Get user profile * * @static * @access public * @param Client $client - * @param string $query + * @param string $username * @return array */ - public static function getUser(Client $client, $query) + public static function getUser(Client $client, $username) { $self = new self(new Query($client)); - return $self->find($query); + return $self->find($self->getLdapUserPattern($username)); } /** @@ -204,4 +204,20 @@ class User return LDAP_USER_BASE_DN; } + + /** + * Get LDAP user pattern + * + * @access public + * @param string $username + * @return string + */ + public function getLdapUserPattern($username) + { + if (! LDAP_USER_FILTER) { + throw new LogicException('LDAP user filter empty, check the parameter LDAP_USER_FILTER'); + } + + return sprintf(LDAP_USER_FILTER, $username); + } } |