本文整理汇总了PHP中Zend_Ldap::getBaseDn方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Ldap::getBaseDn方法的具体用法?PHP Zend_Ldap::getBaseDn怎么用?PHP Zend_Ldap::getBaseDn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Ldap
的用法示例。
在下文中一共展示了Zend_Ldap::getBaseDn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachLdap
/**
* Attach node to an LDAP connection
*
* This is an offline method.
*
* @uses Zend_Ldap_Dn::isChildOf()
* @param Zend_Ldap $ldap
* @return Zend_Ldap_Node Provides a fluid interface
* @throws Zend_Ldap_Exception
*/
public function attachLdap(Zend_Ldap $ldap)
{
if (!Zend_Ldap_Dn::isChildOf($this->_getDn(), $ldap->getBaseDn())) {
/**
* @see Zend_Ldap_Exception
*/
require_once PHP_LIBRARY_PATH . 'Zend/Ldap/Exception.php';
throw new Zend_Ldap_Exception(null, 'LDAP connection is not responsible for given node.', Zend_Ldap_Exception::LDAP_OTHER);
}
if ($ldap !== $this->_ldap) {
$this->_ldap = $ldap;
if (is_array($this->_children)) {
foreach ($this->_children as $child) {
$child->attachLdap($ldap);
}
}
}
return $this;
}
示例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, array $options)
{
$adapterOptions = array('group' => null, 'groupDn' => $ldap->getBaseDn(), 'groupScope' => Zend_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::SEARCH_SCOPE_BASE, Zend_Ldap::SEARCH_SCOPE_ONE, Zend_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: _getDnForLdapAttributes
protected function _getDnForLdapAttributes($attributes)
{
return 'uid=' . $attributes['uid'] . ',o=' . $attributes['o'] . ',' . $this->_ldapClient->getBaseDn();
}
示例4: attachLdap
/**
* Attach node to an LDAP connection
*
* This is an offline method.
*
* @uses Zend_Ldap_Dn::isChildOf()
* @param Zend_Ldap $ldap
* @return Zend_Ldap_Node Provides a fluent interface
* @throws Zend_Ldap_Exception
*/
public function attachLdap(Zend_Ldap $ldap)
{
if (!Zend_Ldap_Dn::isChildOf($this->_getDn(), $ldap->getBaseDn())) {
/**
* @see Zend_Ldap_Exception
*/
throw new Zend_Ldap_Exception(null, 'LDAP connection is not responsible for given node.', Zend_Ldap_Exception::LDAP_OTHER);
}
if ($ldap !== $this->_ldap) {
$this->_ldap = $ldap;
if (is_array($this->_children)) {
foreach ($this->_children as $child) {
/* @var Zend_Ldap_Node $child */
$child->attachLdap($ldap);
}
}
}
return $this;
}
示例5: array
*
* @var $this DbPatch_Command_Patch_PHP
* @var $writer DbPatch_Core_Writer
* @var $db Zend_Db_Adapter_Abstract
* @var $phpFile string
*/
$ldapConfig = EngineBlock_ApplicationSingleton::getInstance()->getConfiguration()->ldap;
$ldapOptions = array('host' => $ldapConfig->host, 'useSsl' => $ldapConfig->useSsl, 'username' => $ldapConfig->userName, 'password' => $ldapConfig->password, 'bindRequiresDn' => $ldapConfig->bindRequiresDn, 'accountDomainName' => $ldapConfig->accountDomainName, 'baseDn' => $ldapConfig->baseDn);
$ldapClient = new Zend_Ldap($ldapOptions);
$ldapClient->bind();
$writer->info("Retrieving all collabPerson entries from LDAP");
//$filter = '(&(objectclass=collabPerson))';
$filter = '(&(objectclass=collabPerson)(!(collabPersonUUID=*)))';
$users = $ldapClient->search($filter);
while (count($users) > 0) {
$writer->info("Retrieved " . count($users) . " users from LDAP");
foreach ($users as $user) {
foreach ($user as $userKey => $userValue) {
if (is_array($userValue) && count($userValue) === 1) {
$user[$userKey] = $userValue[0];
}
}
$user['collabpersonuuid'] = (string) Surfnet_Zend_Uuid::generate();
$now = date(DATE_RFC822);
$user['collabpersonlastupdated'] = $now;
$dn = 'uid=' . $user['uid'] . ',o=' . $user['o'] . ',' . $ldapClient->getBaseDn();
$ldapClient->update($dn, $user);
$writer->info("Set UUID '{$user['collabpersonuuid']}' for DN: '{$dn}'");
}
$users = $ldapClient->search($filter);
}