ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Array.php
Go to the documentation of this file.
1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
28require_once "Auth/Container.php";
32require_once "PEAR.php";
33
72
73 // {{{ properties
74
80 var $users;
81
87 var $cryptType = 'none';
88
89 // }}}
90 // {{{ Auth_Container_Array()
91
99 {
100 if (!is_array($data)) {
101 PEAR::raiseError('The options for Auth_Container_Array must be an array');
102 }
103 if (isset($data['users']) && is_array($data['users'])) {
104 $this->users = $data['users'];
105 } else {
106 $this->users = array();
107 PEAR::raiseError('Auth_Container_Array: no user data found in options array');
108 }
109 if (isset($data['cryptType'])) {
110 $this->cryptType = $data['cryptType'];
111 }
112 }
113
114 // }}}
115 // {{{ fetchData()
116
129 function fetchData($user, $pass)
130 {
131 $this->log('Auth_Container_Array::fetchData() called.', AUTH_LOG_DEBUG);
132 if ( isset($this->users[$user])
133 && $this->verifyPassword($pass, $this->users[$user], $this->cryptType)) {
134 return true;
135 }
136 return false;
137 }
138
139 // }}}
140 // {{{ listUsers()
141
147 function listUsers()
148 {
149 $this->log('Auth_Container_Array::listUsers() called.', AUTH_LOG_DEBUG);
150 $ret = array();
151 foreach ($this->users as $username => $password) {
152 $ret[]['username'] = $username;
153 }
154 return $ret;
155 }
156
157 // }}}
158
159}
160
161?>
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
$cryptType
The cryptType used on the passwords.
Definition: Array.php:87
$users
The users and their password to authenticate against.
Definition: Array.php:80
listUsers()
Returns a list of users available within the container.
Definition: Array.php:147
Auth_Container_Array($data)
Constructor for Array Container.
Definition: Array.php:98
fetchData($user, $pass)
Get user information from array.
Definition: Array.php:129
verifyPassword($password1, $password2, $cryptType="md5")
Crypt and verfiy the entered password.
Definition: Container.php:101
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
$data