Lines Matching refs:user

47                 $this->getConf('user'),
64 ['select-user', 'select-user-groups', 'select-groups', 'insert-user', 'insert-group', 'join-group']
69 ['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'delete-user']
74 ['select-user', 'select-user-groups', 'update-user-login']
79 ['select-user', 'select-user-groups', 'update-user-pass']
84 ['select-user', 'select-user-groups', 'update-user-info:name']
89 ['select-user', 'select-user-groups', 'update-user-info:mail']
94 ['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'join-group', 'insert-group']
116 * Check user+password
118 * @param string $user the user name
122 public function checkPass($user, $pass)
125 $userdata = $this->selectUser($user);
149 * Return user info
151 * Returns info about the given user needs to contain
154 * name string full name of the user
155 * mail string email addres of the user
156 * grps array list of groups the user is in
158 * @param string $user the user name
160 * @return array|bool containing user data or false
162 public function getUserData($user, $requireGroups = true)
164 $data = $this->selectUser($user);
181 * Returns false if the user already exists, null when an error
184 * The new user HAS TO be added to the default group by this
189 * @param string $user
196 public function createUser($user, $clear, $name, $mail, $grps = null)
200 if (($info = $this->getUserData($user, false)) !== false) {
202 return false; // user already exists
210 $userdata = ['user' => $user, 'clear' => $clear, 'hash' => $hash, 'name' => $name, 'mail' => $mail];
215 // insert the user
216 $ok = $this->query($this->getConf('insert-user'), $userdata);
218 $userdata = $this->getUserData($user, false);
231 // add user to the groups
249 * Modify user data
251 * @param string $user nick of the user to be changed
255 public function modifyUser($user, $changes)
260 $olddata = $this->getUserData($user);
264 // changing the user name?
265 if (isset($changes['user'])) {
266 if ($this->getUserData($changes['user'], false)) goto FAIL;
268 $params['newlogin'] = $changes['user'];
270 $ok = $this->query($this->getConf('update-user-login'), $params);
280 $ok = $this->query($this->getConf('update-user-pass'), $params);
290 $ok = $this->query($this->getConf('update-user-info'), $params);
350 foreach ($users as $user) {
351 if ($this->deleteUser($user)) $count++;
357 * Bulk retrieval of user data [implement only where required/possible]
361 * @param int $start index of first user to be returned
372 foreach (['user', 'name', 'mail', 'group'] as $key) {
388 if (!isset($row['user'])) {
389 $this->debugMsg("list-users statement did not return 'user' attribute", -1, __LINE__);
392 $users[] = $this->getUserData($row['user']);
401 * Return a count of the number of user which meet $filter criteria
411 foreach (['user', 'name', 'mail', 'group'] as $key) {
464 * Select data of a specified user
466 * @param string $user the user name
467 * @return bool|array user data, false on error
469 protected function selectUser($user)
471 $sql = $this->getConf('select-user');
473 $result = $this->query($sql, [':user' => $user]);
477 $this->debugMsg('Found more than one matching user', -1, __LINE__);
484 if (!isset($data['user'])) {
485 $this->debugMsg("Statement did not return 'user' attribute", -1, __LINE__);
506 * Delete a user after removing all their group memberships
508 * @param string $user
509 * @return bool true when the user was deleted
511 protected function deleteUser($user)
515 $userdata = $this->getUserData($user);
526 $ok = $this->query($this->getConf('delete-user'), $userdata);
538 * Select all groups of a user
546 $sql = $this->getConf('select-user-groups');
554 $this->debugMsg("No 'group' field returned in select-user-groups statement", -1, __LINE__);
560 $this->debugMsg("select-user-groups statement did not return a list of result", -1, __LINE__);
610 * Adds the user to the group
612 * @param array $userdata all the user data
626 * Removes the user from the group
628 * @param array $userdata all the user data