Beispiel #1
0
 /**
  * Returns a LDIF representation of the current node
  *
  * @param  array $options Additional options used during encoding
  * @return string
  */
 public function toLdif(array $options = array())
 {
     $attributes = array_merge(array('dn' => $this->getDnString()), $this->getData(false));
     /**
      * Zend_Ldap_Ldif_Encoder
      */
     require_once PHP_LIBRARY_PATH . 'Zend/Ldap/Ldif/Encoder.php';
     return Zend_Ldap_Ldif_Encoder::encode($attributes, $options);
 }
Beispiel #2
0
 public function testRoundtripEncoding()
 {
     $node = $this->_createTestNode();
     $ldif = $node->toLdif();
     $data = Zend_Ldap_Ldif_Encoder::decode($ldif);
     $expected = array_merge(array('dn' => $node->getDnString()), $node->getData(false));
     $this->assertEquals($expected, $data);
 }
Beispiel #3
0
 public function testEncodingWithJapaneseCharacters()
 {
     $data = array('dn' => 'uid=rogasawara,ou=営業部,o=Airius', 'objectclass' => array('top', 'person', 'organizationalPerson', 'inetOrgPerson'), 'uid' => array('rogasawara'), 'mail' => array('*****@*****.**'), 'givenname;lang-ja' => array('ロドニー'), 'sn;lang-ja' => array('小笠原'), 'cn;lang-ja' => array('小笠原 ロドニー'), 'title;lang-ja' => array('営業部 部長'), 'preferredlanguage' => array('ja'), 'givenname' => array('ロドニー'), 'sn' => array('小笠原'), 'cn' => array('小笠原 ロドニー'), 'title' => array('営業部 部長'), 'givenname;lang-ja;phonetic' => array('ろどにー'), 'sn;lang-ja;phonetic' => array('おがさわら'), 'cn;lang-ja;phonetic' => array('おがさわら ろどにー'), 'title;lang-ja;phonetic' => array('えいぎょうぶ ぶちょう'), 'givenname;lang-en' => array('Rodney'), 'sn;lang-en' => array('Ogasawara'), 'cn;lang-en' => array('Rodney Ogasawara'), 'title;lang-en' => array('Sales, Director'));
     $expected = 'dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz' . PHP_EOL . 'objectclass: top' . PHP_EOL . 'objectclass: person' . PHP_EOL . 'objectclass: organizationalPerson' . PHP_EOL . 'objectclass: inetOrgPerson' . PHP_EOL . 'uid: rogasawara' . PHP_EOL . 'mail: rogasawara@airius.co.jp' . PHP_EOL . 'givenname;lang-ja:: 44Ot44OJ44OL44O8' . PHP_EOL . 'sn;lang-ja:: 5bCP56yg5Y6f' . PHP_EOL . 'cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==' . PHP_EOL . 'title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==' . PHP_EOL . 'preferredlanguage: ja' . PHP_EOL . 'givenname:: 44Ot44OJ44OL44O8' . PHP_EOL . 'sn:: 5bCP56yg5Y6f' . PHP_EOL . 'cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==' . PHP_EOL . 'title:: 5Za25qWt6YOoIOmDqOmVtw==' . PHP_EOL . 'givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8' . PHP_EOL . 'sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ' . PHP_EOL . 'cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==' . PHP_EOL . 'title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==' . PHP_EOL . 'givenname;lang-en: Rodney' . PHP_EOL . 'sn;lang-en: Ogasawara' . PHP_EOL . 'cn;lang-en: Rodney Ogasawara' . PHP_EOL . 'title;lang-en: Sales, Director';
     $actual = Zend_Ldap_Ldif_Encoder::encode($data, array('sort' => false, 'version' => null));
     $this->assertEquals($expected, $actual);
 }
Beispiel #4
0
 /**
  * Returns a LDIF representation of the current node
  *
  * @param  array $options Additional options used during encoding
  * @return string
  */
 public function toLdif(array $options = array())
 {
     $attributes = array_merge(array('dn' => $this->getDnString()), $this->getData(false));
     /**
      * Zend_Ldap_Ldif_Encoder
      */
     return Zend_Ldap_Ldif_Encoder::encode($attributes, $options);
 }