mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
LdapRepository: Drop method isAmbiguous() and introduce isRelatedDn()
refs #10567
This commit is contained in:
parent
62eb767cd5
commit
6551a86d4d
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user