Lines Matching full:user
17 /** @var array user cache */
58 * Check user+password
60 * Checks if the given user exists and the given
64 * @param string $user
68 public function checkPass($user, $pass) argument
70 $userinfo = $this->getUserData($user);
76 return auth_verifyPassword($pass, $this->users[$user]['pass']);
80 * Return user info
82 * Returns info about the given user needs to contain
85 * name string full name of the user
86 * mail string email addres of the user
87 * grps array list of groups the user is in
90 * @param string $user
94 public function getUserData($user, $requireGroups = true) argument
97 return $this->users[$user] ?? false;
105 * @param string $user
109 * @param array $grps list of groups the user is in
112 protected function createUserLine($user, $pass, $name, $mail, $grps) argument
115 $userline = [$user, $pass, $name, $mail, $groups];
124 * Create a new User
126 * Returns false if the user already exists, null when an error
129 * The new user will be added to the default group by this
135 * @param string $user
142 public function createUser($user, $pwd, $name, $mail, $grps = null) argument
147 // user mustn't already exist
148 if ($this->getUserData($user) !== false) {
158 // prepare user line
159 $userline = $this->createUserLine($user, $pass, $name, $mail, $grps);
166 $this->users[$user] = [
176 * Modify user data
179 * @param string $user nick of the user to be changed
183 public function modifyUser($user, $changes) argument
188 // sanity checks, user must already exist and there must be something to change
189 if (($userinfo = $this->getUserData($user)) === false) {
196 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
203 $newuser = $user;
205 if ($field == 'user') {
221 …if (!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^' . $user . ':/', $userlin…
222 msg('There was an error modifying your user data. You may need to register again.', -1);
228 if (isset($this->users[$user])) unset($this->users[$user]);
249 foreach ($users as $user) {
251 if (!empty($this->users[$user]['protected'])) {
252 msg(sprintf($this->getLang('protected'), hsc($user)), -1);
255 if (isset($this->users[$user])) $deleted[] = preg_quote($user, '/');
266 // reload the user list and count the difference
274 * Return a count of the number of user which meet $filter criteria
291 foreach ($this->users as $user => $info) {
292 $count += $this->filter($user, $info);
299 * Bulk retrieval of user data
303 * @param int $start index of first user to be returned
320 foreach ($this->users as $user => $info) {
321 if ($this->filter($user, $info)) {
323 $out[$user] = $info;
336 * Loads complete user data into memory before searching for groups.
361 * @param string $user
364 public function cleanUser($user) argument
368 return cleanID(str_replace([':', '/', ';'], $conf['sepchar'], $user));
385 * Load all user data
387 * loads the user file into a datastructure
408 * Read user data from given file
442 * Get the user line split into it's parts
452 … Logger::error('User line with less than 5 fields. Possibly corruption in your user file', $data);
458 * return true if $user + $info match $filter criteria, false otherwise
462 * @param string $user User login
463 * @param array $info User's userinfo array
466 protected function filter($user, $info) argument
469 if ($item == 'user') {
470 if (!preg_match($pattern, $user)) return false;