当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Ldap_Node::fromArray方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-ldap-connector,代码行数:30,代码来源:LdapContentItem.php

示例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;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:15,代码来源:Collection.php

示例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;
 }
开发者ID:netixx,项目名称:Stock,代码行数:16,代码来源:Collection.php

示例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());
 }
开发者ID:travisj,项目名称:zf,代码行数:10,代码来源:OnlineTest.php

示例5: _createTestNode

 /**
  * @return Zend_Ldap_Node
  */
 protected function _createTestNode()
 {
     return Zend_Ldap_Node::fromArray($this->_createTestArrayData(), true);
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:7,代码来源:TestCase.php

示例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());
 }
开发者ID:netvlies,项目名称:zf,代码行数:16,代码来源:OfflineTest.php

示例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');
     }
 }
开发者ID:luizreginaldo,项目名称:humhub,代码行数:30,代码来源:HLdap.php

示例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);
 }
开发者ID:omusico,项目名称:logica,代码行数:10,代码来源:OfflineTest.php


注:本文中的Zend_Ldap_Node::fromArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。