コード例 #1
0
 public function testDnWithMultiValuedRdnRoundTrip()
 {
     $dn1 = 'cn=Surname\\, Firstname+uid=userid,cn=name2,dc=example,dc=org';
     $dnArray = Zend_Ldap_Dn::explodeDn($dn1);
     $dn2 = Zend_Ldap_Dn::implodeDn($dnArray);
     $this->assertEquals($dn1, $dn2);
 }
 /**
  * fetch domain config with domain sid and name
  *
  * @throws Tinebase_Exception_Backend_Ldap
  * @throws Zend_Ldap_Exception
  * @return array
  *
  * TODO cache this longer?
  */
 public function getDomainConfiguration()
 {
     if ($this->_domainConfig === null) {
         $this->_domainConfig = $this->getLdap()->search('objectClass=domain', $this->getLdap()->getFirstNamingContext(), Zend_Ldap::SEARCH_SCOPE_BASE)->getFirst();
         $this->_domainConfig['domainSidBinary'] = $this->_domainConfig['objectsid'][0];
         $this->_domainConfig['domainSidPlain'] = Tinebase_Ldap::decodeSid($this->_domainConfig['objectsid'][0]);
         $domainNameParts = array();
         $keys = null;
         // not really needed
         Zend_Ldap_Dn::explodeDn($this->_domainConfig['distinguishedname'][0], $keys, $domanNameParts);
         $this->_domainConfig['domainName'] = implode('.', $domainNameParts);
     }
     return $this->_domainConfig;
 }
コード例 #3
0
ファイル: Ldap.php プロジェクト: jpbender/mage_virtual
 /**
  * Copies a LDAP entry from one DN to another DN.
  *
  * @param  string|Zend_Ldap_Dn $from
  * @param  string|Zend_Ldap_Dn $to
  * @param  boolean             $recursively
  * @return Zend_Ldap Provides a fluid interface
  * @throws Zend_Ldap_Exception
  */
 public function copy($from, $to, $recursively = false)
 {
     $entry = $this->getEntry($from, array(), true);
     if ($to instanceof Zend_Ldap_Dn) {
         $toDnParts = $to->toArray();
     } else {
         $toDnParts = Zend_Ldap_Dn::explodeDn($to);
     }
     $this->add($to, $entry);
     if ($recursively === true && $this->countChildren($from) > 0) {
         $children = $this->_getChildrenDns($from);
         foreach ($children as $c) {
             $cDnParts = Zend_Ldap_Dn::explodeDn($c);
             $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts);
             $newChild = Zend_Ldap_Dn::implodeDn($newChildParts);
             $this->copy($c, $newChild, true);
         }
     }
     return $this;
 }
コード例 #4
0
 /**
  * @dataProvider rfc2253DnProvider
  */
 public function testExplodeDnsProvidedByRFC2253($input, $expected)
 {
     $dnArray = Zend_Ldap_Dn::explodeDn($input);
     $this->assertEquals($expected, $dnArray);
 }
コード例 #5
0
ファイル: OfflineTest.php プロジェクト: netvlies/zf
 public function testGetDnArray()
 {
     $data = $this->_createTestArrayData();
     $node = Zend_Ldap_Node::fromArray($data);
     $exA = Zend_Ldap_Dn::explodeDn($data['dn']);
     $this->assertEquals($exA, $node->getDnArray());
 }
 /**
  * the constructor
  *
  * @param  array  $_options  Options used in connecting, binding, etc.
  * @throws Tinebase_Exception_Backend_Ldap
  */
 public function __construct(array $_options = array())
 {
     if (empty($_options['userUUIDAttribute'])) {
         $_options['userUUIDAttribute'] = 'objectGUID';
     }
     if (empty($_options['groupUUIDAttribute'])) {
         $_options['groupUUIDAttribute'] = 'objectGUID';
     }
     if (empty($_options['baseDn'])) {
         $_options['baseDn'] = $_options['userDn'];
     }
     if (empty($_options['userFilter'])) {
         $_options['userFilter'] = 'objectclass=user';
     }
     if (empty($_options['userSearchScope'])) {
         $_options['userSearchScope'] = Zend_Ldap::SEARCH_SCOPE_SUB;
     }
     if (empty($_options['groupFilter'])) {
         $_options['groupFilter'] = 'objectclass=group';
     }
     parent::__construct($_options);
     if ($this->_options['useRfc2307']) {
         $this->_requiredObjectClass[] = 'posixAccount';
         $this->_requiredObjectClass[] = 'shadowAccount';
         $this->_rowNameMapping['accountHomeDirectory'] = 'unixhomedirectory';
         $this->_rowNameMapping['accountLoginShell'] = 'loginshell';
     }
     // get domain sid
     $this->_domainConfig = $this->_ldap->search('objectClass=domain', $this->_ldap->getFirstNamingContext(), Zend_Ldap::SEARCH_SCOPE_BASE)->getFirst();
     $this->_domainSidBinary = $this->_domainConfig['objectsid'][0];
     $this->_domainSidPlain = Tinebase_Ldap::decodeSid($this->_domainConfig['objectsid'][0]);
     $domanNameParts = array();
     $keys = null;
     // not really needed
     Zend_Ldap_Dn::explodeDn($this->_domainConfig['distinguishedname'][0], $keys, $domanNameParts);
     $this->_domainName = implode('.', $domanNameParts);
 }
 /**
  * the constructor
  *
  * @param  array $options Options used in connecting, binding, etc.
  */
 public function __construct(array $_options)
 {
     if (empty($_options['userUUIDAttribute'])) {
         $_options['userUUIDAttribute'] = 'objectGUID';
     }
     if (empty($_options['groupUUIDAttribute'])) {
         $_options['groupUUIDAttribute'] = 'objectGUID';
     }
     if (empty($_options['baseDn'])) {
         $_options['baseDn'] = $_options['userDn'];
     }
     if (empty($_options['userFilter'])) {
         $_options['userFilter'] = 'objectclass=user';
     }
     if (empty($_options['userSearchScope'])) {
         $_options['userSearchScope'] = Zend_Ldap::SEARCH_SCOPE_SUB;
     }
     if (empty($_options['groupFilter'])) {
         $_options['groupFilter'] = 'objectclass=group';
     }
     parent::__construct($_options);
     // get domain sid
     $this->_domainConfig = $this->getLdap()->search('objectClass=domain', $this->getLdap()->getFirstNamingContext(), Zend_Ldap::SEARCH_SCOPE_BASE)->getFirst();
     $this->_domainSidBinary = $this->_domainConfig['objectsid'][0];
     $this->_domainSidPlain = Tinebase_Ldap::decodeSid($this->_domainConfig['objectsid'][0]);
     $domanNameParts = array();
     Zend_Ldap_Dn::explodeDn($this->_domainConfig['distinguishedname'][0], $fooBar, $domanNameParts);
     $this->_domainName = implode('.', $domanNameParts);
 }