本文整理汇总了PHP中Zend_Ldap_Node::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Ldap_Node::fromArray方法的具体用法?PHP Zend_Ldap_Node::fromArray怎么用?PHP Zend_Ldap_Node::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Ldap_Node
的用法示例。
在下文中一共展示了Zend_Ldap_Node::fromArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($source = null, $entry = null)
{
if ($entry && (is_object($entry) || is_array($entry))) {
if (is_array($entry)) {
$entry = Zend_Ldap_Node::fromArray($entry);
}
$this->node = $entry;
$attrs = $entry->getAttributes(false);
foreach ($attrs as $attr => $value) {
$this->remoteProperties[$attr] = $value;
}
if (isset($this->uid)) {
$this->Title = is_array($this->uid) ? implode($this->uid) : $this->uid;
} else {
if (isset($this->cn)) {
$this->Title = is_array($this->cn) ? implode($this->cn) : $this->cn;
} else {
if (isset($this->ou)) {
$this->Title = is_array($this->ou) ? implode($this->ou) : $this->ou;
} else {
$this->Title = $entry->getCurrentDN();
}
}
}
$this->DN = $entry->getCurrentDN();
parent::__construct($source, $entry->getCurrentDn());
} else {
parent::__construct($source, $entry);
}
}
示例2: _createEntry
/**
* Creates the data structure for the given entry data
*
* @param array $data
* @return Zend_Ldap_Node
*/
protected function _createEntry(array $data)
{
/**
* @see Zend_Ldap_Node
*/
$node = Zend_Ldap_Node::fromArray($data, true);
$node->attachLdap($this->_iterator->getLdap());
return $node;
}
示例3: _createEntry
/**
* Creates the data structure for the given entry data
*
* @param array $data
* @return Zend_Ldap_Node
*/
protected function _createEntry(array $data)
{
/**
* @see Zend_Ldap_Node
*/
require_once PHP_LIBRARY_PATH . 'Zend/Ldap/Node.php';
$node = Zend_Ldap_Node::fromArray($data, true);
$node->attachLdap($this->_iterator->getLdap());
return $node;
}
示例4: testExistsDn
public function testExistsDn()
{
$data = array('dn' => $this->_createDn('ou=name,'), 'ou' => array('name'), 'l' => array('a', 'b', 'c'), 'objectClass' => array('organizationalUnit', 'top'));
$node1 = Zend_Ldap_Node::fromArray($data);
$node1->attachLdap($this->_getLdap());
$this->assertFalse($node1->exists());
$dn = $this->_createDn('ou=Test1,');
$node2 = Zend_Ldap_Node::fromLdap($dn, $this->_getLdap());
$this->assertTrue($node2->exists());
}
示例5: _createTestNode
/**
* @return Zend_Ldap_Node
*/
protected function _createTestNode()
{
return Zend_Ldap_Node::fromArray($this->_createTestArrayData(), true);
}
示例6: testDnObjectCloning
public function testDnObjectCloning()
{
$node1 = $this->_createTestNode();
$dn1 = Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
$node1->setDn($dn1);
$dn1->prepend(array('cn' => 'name'));
$this->assertNotEquals($dn1->toString(), $node1->getDn()->toString());
$dn2 = Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
$node2 = Zend_Ldap_Node::create($dn2);
$dn2->prepend(array('cn' => 'name'));
$this->assertNotEquals($dn2->toString(), $node2->getDn()->toString());
$dn3 = Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
$node3 = Zend_Ldap_Node::fromArray(array('dn' => $dn3, 'ou' => 'Test'), false);
$dn3->prepend(array('cn' => 'name'));
$this->assertNotEquals($dn3->toString(), $node3->getDn()->toString());
}
示例7: refreshUsers
/**
* Reads out all users from configured ldap backend and creates or update
* existing users.
*
* Also disabling deleted ldap users in humhub
*/
public function refreshUsers()
{
$ldapUserIds = array();
try {
$items = $this->ldap->search(HSetting::Get('userFilter', 'authentication_ldap'), HSetting::Get('baseDn', 'authentication_ldap'), Zend_Ldap::SEARCH_SCOPE_SUB);
foreach ($items as $item) {
$node = Zend_Ldap_Node::fromArray($item);
$user = $this->handleLdapUser($node);
if ($user != null) {
$ldapUserIds[] = $user->id;
}
}
foreach (User::model()->findAllByAttributes(array('auth_mode' => User::AUTH_MODE_LDAP), 'status!=' . User::STATUS_DISABLED) as $user) {
if (!in_array($user->id, $ldapUserIds)) {
// User not longer available in ldap
$user->status = User::STATUS_DISABLED;
$user->save();
Yii::log('Disabled user ' . $user->username . ' (' . $user->id . ') - Not found in LDAP!', CLogger::LEVEL_ERROR, 'authentication_ldap');
}
}
} catch (Exception $ex) {
Yii::log($ex->getMessage(), CLogger::LEVEL_ERROR, 'authentication_ldap');
}
}
示例8: testRdnAttributesHandleMultiValuedAttribute3
/**
* ZF-11611
*/
public function testRdnAttributesHandleMultiValuedAttribute3()
{
$data = array('dn' => 'cn=funkygroup,ou=Groupes,dc=domain,dc=local', 'objectClass' => array('groupOfNames', 'top'), 'cn' => array(0 => 'The Funkygroup'), 'member' => 'uid=john-doe,ou=Users,dc=domain,dc=local');
$node = Zend_Ldap_Node::fromArray($data, true);
$cn = $node->getAttribute('cn');
$this->assertEquals(array(0 => 'The Funkygroup', 1 => 'funkygroup'), $cn);
}