本文整理汇总了PHP中Zend\Ldap\Ldap::getBaseDn方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getBaseDn方法的具体用法?PHP Ldap::getBaseDn怎么用?PHP Ldap::getBaseDn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Ldap\Ldap
的用法示例。
在下文中一共展示了Ldap::getBaseDn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findUnit
private function findUnit(Identity $identity)
{
if (null === $this->unit) {
$filter = Filter::equals('mail', $identity->mail);
$baseDn = Dn::factory($this->ldap->getBaseDn())->prepend(['ou' => 'people']);
$result = $this->ldap->search($filter, $baseDn, Ldap::SEARCH_SCOPE_ONE, ['l']);
if (1 !== $result->count()) {
return;
}
$result = $result->current();
$unitDn = $result['l'][0];
$this->unit = $this->ldap->getNode($unitDn);
}
return $this->unit;
}
示例2: _prepareOptions
/**
* Sets the LDAP specific options on the Zend_Ldap instance
*
* @param Zend_Ldap $ldap
* @param array $options
* @return array of auth-adapter specific options
*/
protected function _prepareOptions(\Zend\Ldap\Ldap $ldap, array $options)
{
$adapterOptions = array('group' => null, 'groupDn' => $ldap->getBaseDn(), 'groupScope' => \Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, 'groupAttr' => 'cn', 'groupFilter' => 'objectClass=groupOfUniqueNames', 'memberAttr' => 'uniqueMember', 'memberIsDn' => true);
foreach ($adapterOptions as $key => $value) {
if (array_key_exists($key, $options)) {
$value = $options[$key];
unset($options[$key]);
switch ($key) {
case 'groupScope':
$value = (int) $value;
if (in_array($value, array(\Zend\Ldap\Ldap::SEARCH_SCOPE_BASE, \Zend\Ldap\Ldap::SEARCH_SCOPE_ONE, \Zend\Ldap\Ldap::SEARCH_SCOPE_SUB), true)) {
$adapterOptions[$key] = $value;
}
break;
case 'memberIsDn':
$adapterOptions[$key] = $value === true || $value === '1' || strcasecmp($value, 'true') == 0;
break;
default:
$adapterOptions[$key] = trim($value);
break;
}
}
}
$ldap->setOptions($options);
return $adapterOptions;
}
示例3: attachLdap
/**
* Attach node to an LDAP connection
*
* This is an offline method.
*
* @param Ldap $ldap
* @return Node Provides a fluid interface
* @throws Exception\LdapException
*/
public function attachLdap(Ldap $ldap)
{
if (!Dn::isChildOf($this->_getDn(), $ldap->getBaseDn())) {
throw new Exception\LdapException(null, 'LDAP connection is not responsible for given node.', Exception\LdapException::LDAP_OTHER);
}
if ($ldap !== $this->ldap) {
$this->ldap = $ldap;
if (is_array($this->children)) {
foreach ($this->children as $child) {
$child->attachLdap($ldap);
}
}
}
return $this;
}