Net_LDAP
[ class tree: Net_LDAP ] [ index: Net_LDAP ] [ all elements ]

Source for file RootDSE.php

Documentation is available at RootDSE.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +--------------------------------------------------------------------------+
  4. // | Net_LDAP                                                                 |
  5. // +--------------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                    |
  7. // +--------------------------------------------------------------------------+
  8. // | This library is free software; you can redistribute it and/or            |
  9. // | modify it under the terms of the GNU Lesser General Public               |
  10. // | License as published by the Free Software Foundation; either             |
  11. // | version 2.1 of the License, or (at your option) any later version.       |
  12. // |                                                                          |
  13. // | This library is distributed in the hope that it will be useful,          |
  14. // | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
  15. // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        |
  16. // | Lesser General Public License for more details.                          |
  17. // |                                                                          |
  18. // | You should have received a copy of the GNU Lesser General Public         |
  19. // | License along with this library; if not, write to the Free Software      |
  20. // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA |
  21. // +--------------------------------------------------------------------------+
  22. // | Authors: Jan Wagner                                                      |
  23. // +--------------------------------------------------------------------------+
  24. //
  25. // $Id: RootDSE.php,v 1.8 2006/12/22 11:16:57 beni Exp $
  26.  
  27. /**
  28.  * Getting the rootDSE entry of a LDAP server
  29.  *
  30.  * @package Net_LDAP
  31.  * @author Jan Wagner <wagner@netsols.de>
  32.  * @version $Revision: 1.8 $
  33.  */
  34. class Net_LDAP_RootDSE extends PEAR
  35. {
  36.     /**
  37.      * @access private
  38.      * @var object Net_LDAP_Entry 
  39.      ***/
  40.     var $_entry;
  41.  
  42.     /**
  43.      * class constructor
  44.      *
  45.      * @param Net_LDAP_Entry $entry Net_LDAP_Entry object
  46.      */
  47.     function Net_LDAP_RootDSE(&$entry)
  48.     {
  49.         $this->_entry $entry;
  50.     }
  51.  
  52.     /**
  53.      * Gets the requested attribute value
  54.      *
  55.      * Same usuage as {@link Net_LDAP_Entry::get_value()}
  56.      *
  57.      * @access public
  58.      * @param string $attr     Attribute name
  59.      * @param array  $options  Array of options
  60.      * @return mixed Net_LDAP_Error object or attribute values
  61.      * @see Net_LDAP_Entry::get_value()
  62.      */
  63.     function getValue($attr ''$options '')
  64.     {
  65.         return $this->_entry->get_value($attr$options);
  66.     }
  67.  
  68.     /**
  69.      * alias function of getValue() for perl-ldap interface
  70.      *
  71.      * @see getValue()
  72.      */
  73.      function get_value()
  74.      {
  75.         $args func_get_args();
  76.         return call_user_func_array(array&$this'getValue' )$args);
  77.      }
  78.  
  79.     /**
  80.      * Determines if the extension is supported
  81.      *
  82.      * @access public
  83.      * @param array $oids Array of oids to check
  84.      * @return boolean 
  85.      */
  86.     function supportedExtension($oids)
  87.     {
  88.         return $this->_checkAttr($oids'supportedExtension');
  89.     }
  90.  
  91.     /**
  92.      * alias function of supportedExtension() for perl-ldap interface
  93.      *
  94.      * @see supportedExtension()
  95.      */
  96.      function supported_extension()
  97.      {
  98.         $args func_get_args();
  99.         return call_user_func_array(array&$this'supportedExtension')$args);
  100.      }
  101.  
  102.     /**
  103.      * Determines if the version is supported
  104.      *
  105.      * @access public
  106.      * @param array $versions Versions to check
  107.      * @return boolean 
  108.      */
  109.     function supportedVersion($versions)
  110.     {
  111.         return $this->_checkAttr($versions'supportedLDAPVersion');
  112.     }
  113.  
  114.     /**
  115.      * alias function of supportedVersion() for perl-ldap interface
  116.      *
  117.      * @see supportedVersion()
  118.      */
  119.      function supported_version()
  120.      {
  121.         $args func_get_args();
  122.         return call_user_func_array(array(&$this'supportedVersion')$args);
  123.      }    
  124.  
  125.      /**
  126.      * Determines if the control is supported
  127.      *
  128.      * @access public
  129.      * @param array $oids Control oids to check
  130.      * @return boolean 
  131.      */
  132.     function supportedControl($oids)
  133.     {
  134.         return $this->_checkAttr($oids'supportedControl');
  135.     }
  136.  
  137.     /**
  138.      * alias function of supportedControl() for perl-ldap interface
  139.      *
  140.      * @see supportedControl()
  141.      */
  142.      function supported_control()
  143.      {
  144.         $args func_get_args();
  145.         return call_user_func_array(array(&$this'supportedControl' )$args);
  146.      }
  147.  
  148.     /**
  149.      * Determines if the sasl mechanism is supported
  150.      *
  151.      * @access public
  152.      * @param array $mechlist SASL mechanisms to check
  153.      * @return boolean 
  154.      */
  155.     function supportedSASLMechanism($mechlist)
  156.     {
  157.         return $this->_checkAttr($mechlist'supportedSASLMechanisms');
  158.     }
  159.  
  160.     /**
  161.      * alias function of supportedSASLMechanism() for perl-ldap interface
  162.      *
  163.      * @see supportedSASLMechanism()
  164.      */
  165.      function supported_sasl_mechanism(
  166.      {
  167.         $args func_get_args();
  168.         return call_user_func_array(array(&$this'supportedSASLMechanism')$args);
  169.      }
  170.  
  171.      /**
  172.      * Checks for existance of value in attribute
  173.      *
  174.      * @access private
  175.      * @param array $values values to check
  176.      * @param attr $attr attribute name
  177.      * @return boolean 
  178.      */
  179.     function _checkAttr($values$attr)
  180.     {
  181.         if (!is_array($values)) $values = array($values);
  182.  
  183.         foreach ($values as $value{
  184.             if (!@in_array($value$this->get_value($attr'all'))) {
  185.                 return false;
  186.             }
  187.         }
  188.         return true;
  189.     }
  190. }
  191.  
  192. ?>

Documentation generated on Mon, 11 Mar 2019 15:01:39 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.