LdapRepository: Drop method isAmbiguous() and introduce isRelatedDn()

refs #10567
This commit is contained in:
Johannes Meyer 2015-11-09 11:40:30 +01:00
parent 62eb767cd5
commit 6551a86d4d

View File

@ -42,15 +42,6 @@ abstract class LdapRepository extends Repository
'groupofuniquenames' => 'groupOfUniqueNames' 'groupofuniquenames' => 'groupOfUniqueNames'
); );
/**
* Object attributes whose value is not distinguished name
*
* @var array
*/
protected $ambiguousAttributes = array(
'posixGroup' => 'memberUid'
);
/** /**
* Create a new LDAP repository object * Create a new LDAP repository object
* *
@ -79,15 +70,19 @@ abstract class LdapRepository extends Repository
} }
/** /**
* Return whether the given object attribute's value is not a distinguished name * Return whether the given object DN is related to the given base DN
* *
* @param string $objectClass * Will use the current connection's root DN if $baseDn is not given.
* @param string $attributeName *
* @param string $dn The object DN to check
* @param string $baseDn The base DN to compare the object DN with
* *
* @return bool * @return bool
*/ */
protected function isAmbiguous($objectClass, $attributeName) protected function isRelatedDn($dn, $baseDn = null)
{ {
return isset($this->ambiguousAttributes[$objectClass][$attributeName]); $normalizedDn = strtolower(join(',', array_map('trim', explode(',', $dn))));
$normalizedBaseDn = strtolower(join(',', array_map('trim', explode(',', $baseDn ?: $this->ds->getDn()))));
return strpos($normalizedDn, $normalizedBaseDn) !== false;
} }
} }