Lines Matching refs:user

14     /** @var array user cache */
55 * Check user+password
57 * Checks if the given user exists and the given
61 * @param string $user
65 public function checkPass($user, $pass) {
66 $userinfo = $this->getUserData($user);
69 return auth_verifyPassword($pass, $this->users[$user]['pass']);
73 * Return user info
75 * Returns info about the given user needs to contain
78 * name string full name of the user
79 * mail string email addres of the user
80 * grps array list of groups the user is in
83 * @param string $user
87 public function getUserData($user, $requireGroups=true) {
89 return isset($this->users[$user]) ? $this->users[$user] : false;
97 * @param string $user
101 * @param array $grps list of groups the user is in
104 protected function _createUserLine($user, $pass, $name, $mail, $grps) {
106 $userline = array($user, $pass, $name, $mail, $groups);
116 * Returns false if the user already exists, null when an error
119 * The new user will be added to the default group by this
125 * @param string $user
132 public function createUser($user, $pwd, $name, $mail, $grps = null) {
136 // user mustn't already exist
137 if($this->getUserData($user) !== false) {
147 // prepare user line
148 $userline = $this->_createUserLine($user, $pass, $name, $mail, $grps);
155 $this->users[$user] = compact('pass', 'name', 'mail', 'grps');
160 * Modify user data
163 * @param string $user nick of the user to be changed
167 public function modifyUser($user, $changes) {
171 // sanity checks, user must already exist and there must be something to change
172 if(($userinfo = $this->getUserData($user)) === false) {
179 $newuser = $user;
181 if($field == 'user') {
191 …if(!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^'.$user.':/', $userline, tr…
192 msg('There was an error modifying your user data. You may need to register again.', -1);
217 foreach($users as $user) {
218 if(isset($this->users[$user])) $deleted[] = preg_quote($user, '/');
229 // reload the user list and count the difference
237 * Return a count of the number of user which meet $filter criteria
253 foreach($this->users as $user => $info) {
254 $count += $this->_filter($user, $info);
261 * Bulk retrieval of user data
265 * @param int $start index of first user to be returned
281 foreach($this->users as $user => $info) {
282 if($this->_filter($user, $info)) {
284 $out[$user] = $info;
298 * @param string $user
301 public function cleanUser($user) {
303 return cleanID(str_replace(':', $conf['sepchar'], $user));
318 * Load all user data
320 * loads the user file into a datastructure
379 * return true if $user + $info match $filter criteria, false otherwise
383 * @param string $user User login
387 protected function _filter($user, $info) {
389 if($item == 'user') {
390 if(!preg_match($pattern, $user)) return false;