Lines Matching defs:user
7 * a user by calling auth_login()
66 // degrade to unauthenticated user
77 // Populate Basic Auth user/password from Authorization header
92 // apply cleaning (auth specific user names, remove control chars)
109 'user' => $INPUT->str('u'),
125 * Loads the ACL setup and handle user wildcards
148 // substitute user wildcard first (its 1:1)
150 // if user is not logged in, this ACL line is meaningless - skip it
159 // if user is not logged in, grps is empty, no output will be added (i.e. skipped)
221 // fetch user info from backend
222 $user = $authtoken->getUser();
223 $USERINFO = $auth->getUserData($user);
226 // the code is correct, set up user
227 $INPUT->server->set('REMOTE_USER', $user);
228 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
245 $evdata['user'],
253 * This tries to login the user based on the sent auth credentials
256 * a new login is assumed and user/password are checked. If they
264 * no further testing is done and the user is accepted
273 * @param string $user Username
282 function auth_login($user, $pass, $sticky = false, $silent = false)
294 if (!empty($user)) {
296 if (!empty($pass) && $auth->checkPass($user, $pass)) {
298 $INPUT->server->set('REMOTE_USER', $user);
300 auth_setCookie($user, auth_encrypt($pass, $secret), $sticky);
313 [$user, $sticky, $pass] = auth_getCookie();
314 if ($user && $pass) {
322 $auth->useSessionCache($user) &&
324 ($session['user'] == $user) &&
329 $INPUT->server->set('REMOTE_USER', $user);
337 return auth_login($user, $pass, $sticky, true);
490 * Log out the current user
492 * This clears all authentication data and thus log the user
511 if (isset($_SESSION[DOKU_COOKIE]['auth']['user']))
512 unset($_SESSION[DOKU_COOKIE]['auth']['user']);
537 * Check if a user is a manager
540 * user.
544 * @param string $user Username
545 * @param array $groups List of groups the user is in
546 * @param bool $adminonly when true checks if user is admin
553 function auth_ismanager($user = null, $groups = null, $adminonly = false, $recache = false)
564 if (is_null($user)) {
568 $user = $INPUT->server->str('REMOTE_USER');
572 // checking the logged in user, or another one?
573 if ($USERINFO && $user === $INPUT->server->str('REMOTE_USER')) {
576 $groups = $auth->getUserData($user);
583 $cachekey = serialize([$user, $adminonly, $groups]);
586 $ok = auth_isMember($conf['superuser'], $user, $groups);
590 $ok = auth_isMember($conf['manager'], $user, $groups);
600 * Check if a user is admin
606 * @param string $user Username
607 * @param array $groups List of groups the user is in
614 function auth_isadmin($user = null, $groups = null, $recache = false)
616 return auth_ismanager($user, $groups, true, $recache);
620 * Match a user and his groups against a comma separated list of
626 * @param string $user user to match against
627 * @param array $groups groups the user is member of
630 function auth_isMember($memberlist, $user, array $groups)
636 // clean user and groups
638 $user = PhpString::strtolower($user);
641 $user = $auth->cleanUser($user);
659 if ($member == $user) return true;
670 * This checks the permissions for the current user
689 * Returns the maximum rights a user has for the given ID or its namespace
695 * @param string $user Username
696 * @param array|null $groups Array of groups the user is in
699 function auth_aclcheck($id, $user, $groups)
703 'user' => $user,
723 $user =& $data['user'];
739 //if user is superuser or in superusergroup return 255 (acl_admin)
740 if (auth_isadmin($user, $groups)) {
745 $user = PhpString::strtolower($user);
748 $user = auth_nameencode($auth->cleanUser($user));
763 if ($user) $groups[] = $user;
837 * Some auth backends allow special chars in their user and groupnames
935 * Sends a password to the given user
939 * @param string $user Login name of the user
943 function auth_sendPassword($user, $password)
950 $user = $auth->cleanUser($user);
951 $userinfo = $auth->getUserData($user, false);
958 'LOGIN' => $user,
970 * Register a new user
972 * This registers a new user - Data is read directly from $_POST
1018 //okay try to create the user
1024 // send notification about the new user
1034 // autogenerated password? then send password to user
1045 * Update user profile
1123 [/* user */, $sticky, /* pass */] = auth_getCookie();
1138 * Delete the current logged-in user
1215 // we're in token phase - get user info from token
1231 $user = io_readfile($tfile);
1232 $userinfo = $auth->getUserData($user, false);
1238 if (!$conf['autopasswd']) { // we let the user choose a password
1249 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1254 $pass = auth_pwgen($user);
1255 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1260 if (auth_sendPassword($user, $pass)) {
1278 $user = trim($auth->cleanUser($INPUT->post->str('login')));
1281 $userinfo = $auth->getUserData($user, false);
1292 io_saveFile($tfile, $user);
1295 $trep = ['FULLNAME' => $userinfo['name'], 'LOGIN' => $user, 'CONFIRM' => $url];
1357 * Set the authentication cookie and add user identification data to the session
1359 * @param string $user username
1364 function auth_setCookie($user, $pass, $sticky)
1372 $USERINFO = $auth->getUserData($user);
1375 $cookie = base64_encode($user) . '|' . ((int) $sticky) . '|' . base64_encode($pass);
1387 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
1397 * Returns the user, (encrypted) password and sticky bit from cookie
1406 [$user, $sticky, $pass] = sexplode('|', $_COOKIE[DOKU_COOKIE], 3, '');
1409 $user = base64_decode($user);
1410 return [$user, $sticky, $pass];