Lines Matching +full:list +full:- +full:users -(+path:inc +path:lang) -(+path:lib +path:plugins +path:lang) -(+path:lib +path:tpl +path:dokuwiki +path:lang)

13  * @author     Jan Schumann <js@schumann-it.com>
18 protected $users;
39 if (!@is_readable($config_cascade['plainauth.users']['default'])) {
40 $this->success = false;
42 if (@is_writable($config_cascade['plainauth.users']['default'])) {
43 $this->cando['addUser'] = true;
44 $this->cando['delUser'] = true;
45 $this->cando['modLogin'] = true;
46 $this->cando['modPass'] = true;
47 $this->cando['modName'] = true;
48 $this->cando['modMail'] = true;
49 $this->cando['modGroups'] = true;
51 $this->cando['getUsers'] = true;
52 $this->cando['getUserCount'] = true;
53 $this->cando['getGroups'] = true;
70 $userinfo = $this->getUserData($user);
73 return auth_verifyPassword($pass, $this->users[$user]['pass']);
84 * grps array list of groups the user is in
93 if ($this->users === null) $this->loadUserData();
94 return $this->users[$user] ?? false;
106 * @param array $grps list of groups the user is in
145 if ($this->getUserData($user) !== false) {
146 msg($this->getLang('userexists'), -1);
156 $userline = $this->createUserLine($user, $pass, $name, $mail, $grps);
158 if (!io_saveFile($config_cascade['plainauth.users']['default'], $userline, true)) {
159 msg($this->getLang('writefail'), -1);
163 $this->users[$user] = [
186 if (($userinfo = $this->getUserData($user)) === false) {
187 msg($this->getLang('usernotexists'), -1);
191 // don't modify protected users
193 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
210 $userline = $this->createUserLine(
218 if (!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^' . $user . ':/', $userline, true)) {
219 msg('There was an error modifying your user data. You may need to register again.', -1);
220 // FIXME, io functions should be fail-safe so existing data isn't lost
225 if (isset($this->users[$user])) unset($this->users[$user]);
226 $this->users[$newuser] = $userinfo;
231 * Remove one or more users from the list of registered users
234 * @param array $users array of users to be deleted
235 * @return int the number of users deleted
237 public function deleteUsers($users)
241 if (!is_array($users) || $users === []) return 0;
243 if ($this->users === null) $this->loadUserData();
246 foreach ($users as $user) {
247 // don't delete protected users
248 if (!empty($this->users[$user]['protected'])) {
249 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
252 if (isset($this->users[$user])) $deleted[] = preg_quote($user, '/');
258 if (!io_deleteFromFile($config_cascade['plainauth.users']['default'], $pattern, true)) {
259 msg($this->getLang('writefail'), -1);
263 // reload the user list and count the difference
264 $count = count($this->users);
265 $this->loadUserData();
266 $count -= count($this->users);
281 if ($this->users === null) $this->loadUserData();
283 if ($filter === []) return count($this->users);
286 $this->constructPattern($filter);
288 foreach ($this->users as $user => $info) {
289 $count += $this->filter($user, $info);
301 * @param int $limit max number of users to be returned
308 if ($this->users === null) $this->loadUserData();
310 Sort::ksort($this->users);
315 $this->constructPattern($filter);
317 foreach ($this->users as $user => $info) {
318 if ($this->filter($user, $info)) {
343 if ($this->users === null) $this->loadUserData();
344 foreach ($this->users as $info) {
392 $this->users = $this->readUserFile($config_cascade['plainauth.users']['default']);
394 // support protected users
395 if (!empty($config_cascade['plainauth.users']['protected'])) {
396 $protected = $this->readUserFile($config_cascade['plainauth.users']['protected']);
400 $this->users = array_merge($this->users, $protected);
414 $users = [];
415 if (!file_exists($file)) return $users;
423 $row = $this->splitUserData($line);
430 $users[$row[0]]['pass'] = $row[1];
431 $users[$row[0]]['name'] = urldecode($row[2]);
432 $users[$row[0]]['mail'] = $row[3];
433 $users[$row[0]]['grps'] = $groups;
435 return $users;
465 foreach ($this->pattern as $item => $pattern) {
484 $this->pattern = [];
486 $this->pattern[$item] = '/' . str_replace('/', '\/', $pattern) . '/i'; // allow regex characters