Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
Merge pull
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Apr 15, 2015
1 parent f0cadd6 commit 8b43127
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/Adldap/Classes/AdldapGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ public function members($group, $recursive = NULL)
*
* @param string $groupName The group name to retrieve info about
* @param array $fields Fields to retrieve
* @param bool $isGUID Is the groupName passed a GUID or a name
* @return array|bool
*/
public function info($groupName, array $fields = array())
public function info($groupName, array $fields = array(), $isGUID = false)
{
$this->adldap->utilities()->validateNotNull('Group Name', $groupName);

Expand All @@ -428,9 +429,18 @@ public function info($groupName, array $fields = array())
// We'll assign the default query fields if none are given
if (count($fields) === 0) $fields = $this->defaultQueryFields;

if (stristr($groupName, '+')) $groupName = stripslashes($groupName);
if ($isGUID === true)
{
$filter = "objectguid=" . $this->adldap->utilities()->strGuidToHex($groupName);

$filter = "(&(objectCategory=group)(name=" . $this->adldap->utilities()->ldapSlashes($groupName) . "))";
} else
{
if (stristr($groupName, '+')) $groupName = stripslashes($groupName);

$filter = "name=" . $this->adldap->utilities()->ldapSlashes($groupName);
}

$filter = "(&(objectCategory=group)(name=$filter))";

$results = $this->connection->search($this->adldap->getBaseDn(), $filter, $fields);

Expand Down Expand Up @@ -482,15 +492,12 @@ public function info($groupName, array $fields = array())
*
* @param string $groupName The group name to retrieve info about
* @param null $fields Fields to retrieve
* @param bool $isGUID Is the groupName passed a GUID or a name
* @return \Adldap\collections\AdldapGroupCollection|bool
*/
public function infoCollection($groupName, $fields = NULL)
public function infoCollection($groupName, $fields = NULL, $isGUID = false)
{
if ($groupName === NULL) return false;

if ( ! $this->adldap->getLdapBind()) return false;

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

if ($info) return new AdldapGroupCollection($info, $this->adldap);

Expand Down

0 comments on commit 8b43127

Please sign in to comment.