Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/adLDAP/classes/adLDAPUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,17 @@ public function groups($username, $recursive = NULL, $isGUID = false) {
* @param bool $isGUID Is the username passed a GUID or a samAccountName
* @return array
*/
public function info($username, $fields = NULL, $isGUID = false) {
public function info($username, $fields = NULL, $isGUID = false, $isMail = false) {
if ($username === NULL) { return false; }
if (!$this->adldap->getLdapBind()) { return false; }

if ($isGUID === true) {
$username = $this->adldap->utilities()->strGuidToHex($username);
$filter = "objectguid=" . $username;
}
else if ($isMail === true) {
$filter = "mail=". $username;
}
else if (strpos($username, "@")) {
$filter = "userPrincipalName=" . $username;
}
Expand Down Expand Up @@ -261,11 +264,11 @@ public function info($username, $fields = NULL, $isGUID = false) {
* @param bool $isGUID Is the username passed a GUID or a samAccountName
* @return mixed
*/
public function infoCollection($username, $fields = NULL, $isGUID = false) {
public function infoCollection($username, $fields = NULL, $isGUID = false, $isMail = false) {
if ($username === NULL) { return false; }
if (!$this->adldap->getLdapBind()) { return false; }

$info = $this->info($username, $fields, $isGUID);
$info = $this->info($username, $fields, $isGUID, $isMail);

if ($info !== false) {
$collection = new \adLDAP\collections\adLDAPUserCollection($info, $this->adldap);
Expand Down