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


PHP Zend_Ldap_Dn::fromString方法代码示例

本文整理汇总了PHP中Zend_Ldap_Dn::fromString方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Ldap_Dn::fromString方法的具体用法?PHP Zend_Ldap_Dn::fromString怎么用?PHP Zend_Ldap_Dn::fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Ldap_Dn的用法示例。


在下文中一共展示了Zend_Ldap_Dn::fromString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRecursiveCopyWithDnObjects

 public function testRecursiveCopyWithDnObjects()
 {
     $orgSubTreeDn = Zend_Ldap_Dn::fromString($this->_orgSubTreeDn);
     $newSubTreeDn = Zend_Ldap_Dn::fromString($this->_newSubTreeDn);
     $this->_getLdap()->copy($orgSubTreeDn, $newSubTreeDn, true);
     $this->assertTrue($this->_getLdap()->exists($orgSubTreeDn));
     $this->assertTrue($this->_getLdap()->exists($newSubTreeDn));
     $this->assertEquals(3, $this->_getLdap()->countChildren($orgSubTreeDn));
     $this->assertEquals(3, $this->_getLdap()->countChildren('ou=Subtree1,' . $orgSubTreeDn->toString()));
     $this->assertEquals(3, $this->_getLdap()->countChildren($newSubTreeDn));
     $this->assertEquals(3, $this->_getLdap()->countChildren('ou=Subtree1,' . $newSubTreeDn->toString()));
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:12,代码来源:CopyRenameTest.php

示例2: testLoadFromLdapWithDnObject

 public function testLoadFromLdapWithDnObject()
 {
     $dn = Zend_Ldap_Dn::fromString($this->_createDn('ou=Test1,'));
     $node = Zend_Ldap_Node::fromLdap($dn, $this->_getLdap());
     $this->assertType('Zend_Ldap_Node', $node);
     $this->assertTrue($node->isAttached());
 }
开发者ID:travisj,项目名称:zf,代码行数:7,代码来源:OnlineTest.php

示例3: testArrayAccessImplementation

 public function testArrayAccessImplementation()
 {
     $dnString = 'cn=Baker\\, Alice,cn=Users,dc=example,dc=com';
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $this->assertEquals(array('cn' => 'Baker, Alice'), $dn[0]);
     $this->assertEquals(array('cn' => 'Users'), $dn[1]);
     $this->assertEquals(array('dc' => 'example'), $dn[2]);
     $this->assertEquals(array('dc' => 'com'), $dn[3]);
     $this->assertTrue(isset($dn[0]));
     $this->assertTrue(isset($dn[1]));
     $this->assertTrue(isset($dn[2]));
     $this->assertTrue(isset($dn[3]));
     $this->assertFalse(isset($dn[-1]));
     $this->assertFalse(isset($dn[4]));
     $dn = Zend_Ldap_Dn::fromString($dnString);
     unset($dn[0]);
     $this->assertEquals('cn=Users,dc=example,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     unset($dn[1]);
     $this->assertEquals('cn=Baker\\, Alice,dc=example,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     unset($dn[2]);
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     unset($dn[3]);
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $dn[0] = array('uid' => 'abaker');
     $this->assertEquals('uid=abaker,cn=Users,dc=example,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $dn[1] = array('ou' => 'Lab');
     $this->assertEquals('cn=Baker\\, Alice,ou=Lab,dc=example,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $dn[2] = array('dc' => 'example', 'ou' => 'Test');
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example+ou=Test,dc=com', $dn->toString());
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $dn[3] = array('dc' => 'de+fr');
     $this->assertEquals('cn=Baker\\, Alice,cn=Users,dc=example,dc=de\\+fr', $dn->toString());
 }
开发者ID:omusico,项目名称:logica,代码行数:39,代码来源:ModificationTest.php

示例4: getSchemaDn

 /**
  * Returns the schema DN
  *
  * @return Zend_Ldap_Dn
  */
 public function getSchemaDn()
 {
     $schemaDn = $this->getSchemaNamingContext();
     /**
      * @see Zend_Ldap_Dn
      */
     require_once 'Zend/Ldap/Dn.php';
     return Zend_Ldap_Dn::fromString($schemaDn);
 }
开发者ID:nhp,项目名称:shopware-4,代码行数:14,代码来源:ActiveDirectory.php

示例5: testSimpleRecursiveIteration

 public function testSimpleRecursiveIteration()
 {
     $node = $this->_getLdap()->getBaseNode();
     $ri = new RecursiveIteratorIterator($node, RecursiveIteratorIterator::SELF_FIRST);
     $i = 0;
     foreach ($ri as $rdn => $n) {
         $dn = $n->getDn()->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         $rdn = Zend_Ldap_Dn::implodeRdn($n->getRdnArray(), Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         if ($i == 0) {
             $this->assertEquals(Zend_Ldap_Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER), $dn);
         } else {
             if ($i == 1) {
                 $this->assertEquals('ou=Node', $rdn);
                 $this->assertEquals($this->_createDn('ou=Node,'), $dn);
             } else {
                 if ($i < 4) {
                     $j = $i - 1;
                     $base = $this->_createDn('ou=Node,');
                 } else {
                     $j = $i - 3;
                     $base = Zend_Ldap_Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
                 }
                 $this->assertEquals('ou=Test' . $j, $rdn);
                 $this->assertEquals('ou=Test' . $j . ',' . $base, $dn);
             }
         }
         $i++;
     }
     $this->assertEquals(9, $i);
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:30,代码来源:ChildrenIterationTest.php

示例6: getSchemaDn

 /**
  * Returns the schema DN
  *
  * @return Zend_Ldap_Dn
  */
 public function getSchemaDn()
 {
     $schemaDn = $this->getSubschemaSubentry();
     /**
      * @see Zend_Ldap_Dn
      */
     // require_once 'Zend/Ldap/Dn.php';
     return Zend_Ldap_Dn::fromString($schemaDn);
 }
开发者ID:crlang44,项目名称:frapi,代码行数:14,代码来源:RootDse.php

示例7: 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

示例8: testIsChildOfWithDnObjects

 public function testIsChildOfWithDnObjects()
 {
     $dn1 = Zend_Ldap_Dn::fromString('cb=name1,cn=name2,dc=example,dc=org');
     $dn2 = Zend_Ldap_Dn::fromString('dc=example,dc=org');
     $this->assertTrue(Zend_Ldap_Dn::isChildOf($dn1, $dn2));
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:6,代码来源:MiscTest.php

示例9: _createDn

 protected function _createDn($dn)
 {
     if (substr($dn, -1) !== ',') {
         $dn .= ',';
     }
     $dn = $dn . TESTS_ZEND_LDAP_WRITEABLE_SUBTREE;
     return Zend_Ldap_Dn::fromString($dn)->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
 }
开发者ID:netvlies,项目名称:zf,代码行数:8,代码来源:OnlineTestCase.php

示例10: testEmptyStringDn

 public function testEmptyStringDn()
 {
     $dnString = '';
     $dn = Zend_Ldap_Dn::fromString($dnString);
     $this->assertEquals($dnString, $dn->toString());
 }
开发者ID:netvlies,项目名称:zf,代码行数:6,代码来源:CreationTest.php

示例11: testGetSingleEntryWithDnObject

 public function testGetSingleEntryWithDnObject()
 {
     $dn = Zend_Ldap_Dn::fromString($this->_createDn('ou=Test1,'));
     $entry = $this->_getLdap()->getEntry($dn);
     $this->assertEquals($dn->toString(), $entry["dn"]);
 }
开发者ID:netvlies,项目名称:zf,代码行数:6,代码来源:SearchTest.php

示例12: testSaveWithDnObject

 public function testSaveWithDnObject()
 {
     $dn = Zend_Ldap_Dn::fromString($this->_createDn('ou=TestCreated,'));
     $data = array('ou' => 'TestCreated', 'objectclass' => 'organizationalUnit');
     try {
         $this->_getLdap()->save($dn, $data);
         $this->assertTrue($this->_getLdap()->exists($dn));
         $data['l'] = 'mylocation1';
         $this->_getLdap()->save($dn, $data);
         $this->assertTrue($this->_getLdap()->exists($dn));
         $entry = $this->_getLdap()->getEntry($dn);
         $this->_getLdap()->delete($dn);
         $this->assertEquals('mylocation1', $entry['l'][0]);
     } catch (Zend_Ldap_Exception $e) {
         if ($this->_getLdap()->exists($dn)) {
             $this->_getLdap()->delete($dn);
         }
         $this->fail($e->getMessage());
     }
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:20,代码来源:CrudTest.php

示例13: _deletePropertyFromLdapRawData

 /**
  * (non-PHPdoc)
  */
 protected function _deletePropertyFromLdapRawData($property, $value)
 {
     $ldapProperty = $this->_propertyMapping[$property];
     if (substr($ldapProperty, -8) == ':boolean') {
         $ldapProperty = substr($ldapProperty, 0, -8);
     }
     $managedPath = Zend_Ldap_Dn::fromString($this->_simpleMailConfig['storage_base'], Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
     foreach ($this->_ldapRawData as $index => $dn) {
         // change only entries in storage_base path (if existing)
         if (isset($dn['simplemail_readonly']) || !isset($dn[$ldapProperty])) {
             continue;
         }
         if ($value === false) {
             //unset doesn't remove attribute in ldap
             $this->_ldapRawData[$index][$ldapProperty] = null;
         } elseif (in_array($value, $this->_ldapRawData[$index][$ldapProperty])) {
             $del_index = array_search($value, $this->_ldapRawData[$index][$ldapProperty]);
             unset($this->_ldapRawData[$index][$ldapProperty][$del_index]);
             // don't keep empty arrays
             if (count($this->_ldapRawData[$index][$ldapProperty]) < 1) {
                 unset($this->_ldapRawData[$index][$ldapProperty]);
             }
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:28,代码来源:LdapSimpleMailSchema.php

示例14: getSchemaDn

 /**
  * Returns the schema DN
  *
  * @return Zend_Ldap_Dn
  */
 public function getSchemaDn()
 {
     $schemaDn = $this->getSchemaNamingContext();
     /**
      * @see Zend_Ldap_Dn
      */
     return Zend_Ldap_Dn::fromString($schemaDn);
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:13,代码来源:ActiveDirectory.php


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