File: RootDSE.php

package info (click to toggle)
php-net-ldap 0.6.6-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 196 kB
  • ctags: 257
  • sloc: php: 1,258; xml: 147; makefile: 50
file content (192 lines) | stat: -rw-r--r-- 5,804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +--------------------------------------------------------------------------+
// | Net_LDAP                                                                 |
// +--------------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                                    |
// +--------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or            |
// | modify it under the terms of the GNU Lesser General Public               |
// | License as published by the Free Software Foundation; either             |
// | version 2.1 of the License, or (at your option) any later version.       |
// |                                                                          |
// | This library is distributed in the hope that it will be useful,          |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        |
// | Lesser General Public License for more details.                          |
// |                                                                          |
// | You should have received a copy of the GNU Lesser General Public         |
// | License along with this library; if not, write to the Free Software      |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Authors: Jan Wagner                                                      |
// +--------------------------------------------------------------------------+
//
// $Id: RootDSE.php,v 1.4.2.2 2005/03/01 12:27:43 jw Exp $

/**
 * Getting the rootDSE entry of a LDAP server
 *
 * @package Net_LDAP
 * @author Jan Wagner <wagner@netsols.de>
 * @version $Revision: 1.4.2.2 $
 */
class Net_LDAP_RootDSE extends PEAR
{
    /**
     * @access private
     * @var object Net_LDAP_Entry
     **/
    var $_entry;
    
    /**
     * class constructor
     *
     * @param object Net_LDAP_Entry
     */
    function Net_LDAP_RootDSE(&$entry)
    {
        $this->_entry = $entry;      
    }

    /**
     * Gets the requested attribute value
     *
     * Same usuage as Net_LDAP_Entry::get_value()
     *
     * @access public
     * @param string Attribute name
     * @param array Array of options
     * @return mixed Net_LDAP_Error object or attribute values
     * @see Net_LDAP_Entry::get_value()
     */    
    function getValue($attr = '', $options = '')
    {
        return $this->_entry->get_value($attr, $options);
    }

    /**
     * alias function of getValue() for perl-ldap interface
     * 
     * @see getValue()
     */
     function get_value() 
     {
        $args = func_get_args();
        return call_user_func_array(array($this, 'getValue' ), $args);
     }
    
    /**
     * Determines if the extension is supported
     * 
     * @access public
     * @param array Array of oids to check
     * @return boolean
     */
    function supportedExtension($oids) 
    {        
        return $this->_checkAttr($oids, 'supportedExtension');
    }
    
    /**
     * alias function of supportedExtension() for perl-ldap interface
     * 
     * @see supportedExtension()
     */
     function supported_extension() 
     {
        $args = func_get_args();
        return call_user_func_array(array($this, 'supportedExtension'), $args);
     }
    
    /**
     * Determines if the version is supported
     *
     * @access public
     * @param array Versions to check
     * @return boolean
     */
    function supportedVersion($versions) 
    {
        return $this->_checkAttr($versions, 'supportedLDAPVersion');
    }

    /**
     * alias function of supportedVersion() for perl-ldap interface
     * 
     * @see supportedVersion()
     */
     function supported_version() 
     {
        $args = func_get_args();
        return call_user_func_array(array($this, 'supportedVersion'), $args);
     }    

     /**
     * Determines if the control is supported
     *
     * @access public
     * @param array Control oids to check
     * @return boolean
     */
    function supportedControl($oids)
    {
        return $this->_checkAttr($oids, 'supportedControl');
    }
    
    /**
     * alias function of supportedControl() for perl-ldap interface
     * 
     * @see supportedControl()
     */
     function supported_control() 
     {
        $args = func_get_args();
        return call_user_func_array(array($this, 'supportedControl' ), $args);
     }        
    
    /**
     * Determines if the sasl mechanism is supported
     *
     * @access public
     * @param array SASL mechanisms to check
     * @return boolean
     */
    function supportedSASLMechanism($mechlist)
    {
        return $this->_checkAttr($mechlist, 'supportedSASLMechanisms');
    }

    /**
     * alias function of supportedSASLMechanism() for perl-ldap interface
     * 
     * @see supportedSASLMechanism()
     */
     function supported_sasl_mechanism() 
     {
        $args = func_get_args();
        return call_user_func_array(array($this, 'supportedSASLMechanism'), $args);
     }    
    
     /**
     * Checks for existance of value in attribute
     *
     * @access private
     * @param array $values values to check
     * @param attr $attr attribute name
     * @return boolean
     */
    function _checkAttr($values, $attr)
    {
        if (!is_array($values)) $values = array($values);
     
        foreach ($values as $value) {
            if (!@in_array($value, $this->get_value($attr))) {
                return false;
            }
        }        
        return true;   
    }
}

?>