Example #1
0
 public function testIsChildOfParentDnLonger()
 {
     $dn1 = 'dc=example,dc=de';
     $dn2 = 'cb=name1,cn=name2,dc=example,dc=org';
     $this->assertFalse(LDAP\DN::isChildOf($dn1, $dn2));
 }
Example #2
0
 /**
  * Attach node to an LDAP connection
  *
  * This is an offline method.
  *
  * @uses   \Zend\LDAP\DN::isChildOf()
  * @param  \Zend\LDAP\LDAP $ldap
  * @return \Zend\LDAP\Node\Node Provides a fluid interface
  * @throws \Zend\LDAP\Exception
  */
 public function attachLDAP(LDAP\LDAP $ldap)
 {
     if (!LDAP\DN::isChildOf($this->_getDn(), $ldap->getBaseDn())) {
         throw new LDAP\Exception(null, 'LDAP connection is not responsible for given node.', 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;
 }