Subversion Repositories Applications.papyrus

Rev

Rev 1173 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1173 Rev 1713
Line 19... Line 19...
19
 * @author     Mika Tuupola <tuupola@appelsiini.net> 
19
 * @author     Mika Tuupola <tuupola@appelsiini.net>
20
 * @author     Michael Wallner <mike@php.net>
20
 * @author     Michael Wallner <mike@php.net>
21
 * @author     Adam Ashley <aashley@php.net>
21
 * @author     Adam Ashley <aashley@php.net>
22
 * @copyright  2001-2006 The PHP Group
22
 * @copyright  2001-2006 The PHP Group
23
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
23
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
24
 * @version    CVS: $Id: File.php,v 1.2 2006-12-14 15:04:28 jp_milcent Exp $
24
 * @version    CVS: $Id: File.php,v 1.3 2007-11-19 15:11:00 jp_milcent Exp $
25
 * @link       http://pear.php.net/package/Auth
25
 * @link       http://pear.php.net/package/Auth
26
 */
26
 */
Line 27... Line 27...
27
 
27
 
28
/**
28
/**
Line 50... Line 50...
50
 * @author     Mika Tuupola <tuupola@appelsiini.net> 
50
 * @author     Mika Tuupola <tuupola@appelsiini.net>
51
 * @author     Michael Wallner <mike@php.net>
51
 * @author     Michael Wallner <mike@php.net>
52
 * @author     Adam Ashley <aashley@php.net>
52
 * @author     Adam Ashley <aashley@php.net>
53
 * @copyright  2001-2006 The PHP Group
53
 * @copyright  2001-2006 The PHP Group
54
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
54
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
55
 * @version    Release: 1.4.3  File: $Revision: 1.2 $
55
 * @version    Release: 1.5.4  File: $Revision: 1.3 $
56
 * @link       http://pear.php.net/package/Auth
56
 * @link       http://pear.php.net/package/Auth
57
 */
57
 */
58
class Auth_Container_File extends Auth_Container
58
class Auth_Container_File extends Auth_Container
59
{
59
{
Line 105... Line 105...
105
     * @param   string  password
105
     * @param   string  password
106
     * @return  mixed   boolean|PEAR_Error
106
     * @return  mixed   boolean|PEAR_Error
107
     */
107
     */
108
    function fetchData($user, $pass)
108
    function fetchData($user, $pass)
109
    {
109
    {
-
 
110
        $this->log('Auth_Container_File::fetchData() called.', AUTH_LOG_DEBUG);
110
        return File_Passwd::staticAuth($this->options['type'], $this->pwfile, $user, $pass);
111
        return File_Passwd::staticAuth($this->options['type'], $this->pwfile, $user, $pass);
111
    }
112
    }
Line 112... Line 113...
112
 
113
 
113
    // }}}
114
    // }}}
Line 118... Line 119...
118
     * 
119
     *
119
     * @return   array
120
     * @return   array
120
     */
121
     */
121
    function listUsers()
122
    function listUsers()
122
    {
123
    {
-
 
124
        $this->log('Auth_Container_File::listUsers() called.', AUTH_LOG_DEBUG);
-
 
125
 
123
        $pw_obj = &$this->_load();
126
        $pw_obj = &$this->_load();
124
        if (PEAR::isError($pw_obj)) {
127
        if (PEAR::isError($pw_obj)) {
125
            return array();
128
            return array();
126
        }
129
        }
Line 134... Line 137...
134
            $retVal[] = array("username" => $key, 
137
            $retVal[] = array("username" => $key,
135
                              "password" => $value['passwd'],
138
                              "password" => $value['passwd'],
136
                              "cvsuser"  => $value['system']);
139
                              "cvsuser"  => $value['system']);
137
        }
140
        }
Line -... Line 141...
-
 
141
 
-
 
142
        $this->log('Found '.count($retVal).' users.', AUTH_LOG_DEBUG);
138
 
143
 
139
        return $retVal;
144
        return $retVal;
Line 140... Line 145...
140
    }
145
    }
141
 
146
 
Line 151... Line 156...
151
     *
156
     *
152
     * @return boolean
157
     * @return boolean
153
     */
158
     */
154
    function addUser($user, $pass, $additional='')
159
    function addUser($user, $pass, $additional='')
155
    {
160
    {
-
 
161
        $this->log('Auth_Container_File::addUser() called.', AUTH_LOG_DEBUG);
156
        $params = array($user, $pass);
162
        $params = array($user, $pass);
157
        if (is_array($additional)) {
163
        if (is_array($additional)) {
158
            foreach ($additional as $item) {
164
            foreach ($additional as $item) {
159
                $params[] = $item;
165
                $params[] = $item;
160
            }
166
            }
Line 189... Line 195...
189
     * @param   string  Username
195
     * @param   string  Username
190
     * @return  boolean
196
     * @return  boolean
191
     */
197
     */
192
    function removeUser($user)
198
    function removeUser($user)
193
    {
199
    {
-
 
200
        $this->log('Auth_Container_File::removeUser() called.', AUTH_LOG_DEBUG);
194
        $pw_obj = &$this->_load();
201
        $pw_obj = &$this->_load();
195
        if (PEAR::isError($pw_obj)) {
202
        if (PEAR::isError($pw_obj)) {
196
            return false;
203
            return false;
197
        }
204
        }
Line 218... Line 225...
218
     * @param string Username
225
     * @param string Username
219
     * @param string The new password 
226
     * @param string The new password
220
     */
227
     */
221
    function changePassword($username, $password)
228
    function changePassword($username, $password)
222
    {
229
    {
-
 
230
        $this->log('Auth_Container_File::changePassword() called.', AUTH_LOG_DEBUG);
223
        $pw_obj = &$this->_load();
231
        $pw_obj = &$this->_load();
224
        if (PEAR::isError($pw_obj)) {
232
        if (PEAR::isError($pw_obj)) {
225
            return false;
233
            return false;
226
        }
234
        }
Line 249... Line 257...
249
    function &_load()
257
    function &_load()
250
    {
258
    {
251
        static $pw_obj;
259
        static $pw_obj;
Line 252... Line 260...
252
        
260
 
-
 
261
        if (!isset($pw_obj)) {
253
        if (!isset($pw_obj)) {
262
            $this->log('Instanciating File_Password object of type '.$this->options['type'], AUTH_LOG_DEBUG);
254
            $pw_obj = File_Passwd::factory($this->options['type']);
263
            $pw_obj = File_Passwd::factory($this->options['type']);
255
            if (PEAR::isError($pw_obj)) {
264
            if (PEAR::isError($pw_obj)) {
256
                return $pw_obj;
265
                return $pw_obj;