Horde_Ldap::rootDSE PHP Метод

rootDSE() публичный Метод

This either fetches a fresh rootDSE object or returns it from the internal cache for performance reasons, if possible.
public rootDSE ( array $attrs = [] ) : Horde_Ldap_RootDse
$attrs array Array of attributes to search for.
Результат Horde_Ldap_RootDse Horde_Ldap_RootDse object
    public function rootDSE(array $attrs = array())
    {
        $attrs_signature = serialize($attrs);
        /* See if we need to fetch a fresh object, or if we already
         * requested this object with the same attributes. */
        if (!isset($this->_rootDSECache[$attrs_signature])) {
            $this->_rootDSECache[$attrs_signature] = new Horde_Ldap_RootDse($this, $attrs);
        }
        return $this->_rootDSECache[$attrs_signature];
    }

Usage Example

Пример #1
0
 /**
  * Constructor.
  *
  * Fetches the Schema from an LDAP connection.
  *
  * @param Horde_Ldap $ldap LDAP connection.
  * @param string     $dn   Subschema entry DN.
  *
  * @throws Horde_Ldap_Exception
  */
 public function __construct(Horde_Ldap $ldap, $dn = null)
 {
     if (is_null($dn)) {
         // Get the subschema entry via rootDSE.
         $dse = $ldap->rootDSE(array('subschemaSubentry'));
         $base = $dse->getValue('subschemaSubentry', 'single');
         $dn = $base;
     }
     // Support for buggy LDAP servers (e.g. Siemens DirX 6.x) that
     // incorrectly call this entry subSchemaSubentry instead of
     // subschemaSubentry. Note the correct case/spelling as per RFC 2251.
     if (is_null($dn)) {
         // Get the subschema entry via rootDSE.
         $dse = $ldap->rootDSE(array('subSchemaSubentry'));
         $base = $dse->getValue('subSchemaSubentry', 'single');
         $dn = $base;
     }
     // Final fallback in case there is no subschemaSubentry attribute in
     // the root DSE (this is a bug for an LDAPv3 server so report this to
     // your LDAP vendor if you get this far).
     if (is_null($dn)) {
         $dn = 'cn=Subschema';
     }
     // Fetch the subschema entry.
     $result = $ldap->search($dn, '(objectClass=*)', array('attributes' => array_values($this->types), 'scope' => 'base'));
     $entry = $result->shiftEntry();
     if (!$entry instanceof Horde_Ldap_Entry) {
         throw new Horde_Ldap_Exception('Could not fetch Subschema entry');
     }
     $this->parse($entry);
 }
All Usage Examples Of Horde_Ldap::rootDSE