Example #1
0
 /**
  * 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;
 }
Example #2
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));
 }