Lines Matching refs: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)
209 // fetch user info from backend
210 $user = $authtoken->getUser();
211 $USERINFO = $auth->getUserData($user);
214 // the code is correct, set up user
215 $INPUT->server->set('REMOTE_USER', $user);
216 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
233 $evdata['user'],
241 * This tries to login the user based on the sent auth credentials
244 * a new login is assumed and user/password are checked. If they
252 * no further testing is done and the user is accepted
261 * @param string $user Username
270 function auth_login($user, $pass, $sticky = false, $silent = false)
282 if (!empty($user)) {
284 if (!empty($pass) && $auth->checkPass($user, $pass)) {
286 $INPUT->server->set('REMOTE_USER', $user);
288 auth_setCookie($user, auth_encrypt($pass, $secret), $sticky);
301 [$user, $sticky, $pass] = auth_getCookie();
302 if ($user && $pass) {
310 $auth->useSessionCache($user) &&
312 ($session['user'] == $user) &&
317 $INPUT->server->set('REMOTE_USER', $user);
325 return auth_login($user, $pass, $sticky, true);
478 * Log out the current user
480 * This clears all authentication data and thus log the user
499 if (isset($_SESSION[DOKU_COOKIE]['auth']['user']))
500 unset($_SESSION[DOKU_COOKIE]['auth']['user']);
525 * Check if a user is a manager
528 * user.
532 * @param string $user Username
533 * @param array $groups List of groups the user is in
534 * @param bool $adminonly when true checks if user is admin
541 function auth_ismanager($user = null, $groups = null, $adminonly = false, $recache = false)
552 if (is_null($user)) {
556 $user = $INPUT->server->str('REMOTE_USER');
560 // checking the logged in user, or another one?
561 if ($USERINFO && $user === $INPUT->server->str('REMOTE_USER')) {
564 $groups = $auth->getUserData($user);
571 $cachekey = serialize([$user, $adminonly, $groups]);
574 $ok = auth_isMember($conf['superuser'], $user, $groups);
578 $ok = auth_isMember($conf['manager'], $user, $groups);
588 * Check if a user is admin
594 * @param string $user Username
595 * @param array $groups List of groups the user is in
602 function auth_isadmin($user = null, $groups = null, $recache = false)
604 return auth_ismanager($user, $groups, true, $recache);
608 * Match a user and his groups against a comma separated list of
614 * @param string $user user to match against
615 * @param array $groups groups the user is member of
618 function auth_isMember($memberlist, $user, array $groups)
624 // clean user and groups
626 $user = PhpString::strtolower($user);
629 $user = $auth->cleanUser($user);
647 if ($member == $user) return true;
658 * This checks the permissions for the current user
677 * Returns the maximum rights a user has for the given ID or its namespace
683 * @param string $user Username
684 * @param array|null $groups Array of groups the user is in
687 function auth_aclcheck($id, $user, $groups)
691 'user' => $user,
711 $user =& $data['user'];
727 //if user is superuser or in superusergroup return 255 (acl_admin)
728 if (auth_isadmin($user, $groups)) {
733 $user = PhpString::strtolower($user);
736 $user = auth_nameencode($auth->cleanUser($user));
751 if ($user) $groups[] = $user;
825 * Some auth backends allow special chars in their user and groupnames
923 * Sends a password to the given user
927 * @param string $user Login name of the user
931 function auth_sendPassword($user, $password)
938 $user = $auth->cleanUser($user);
939 $userinfo = $auth->getUserData($user, false);
946 'LOGIN' => $user,
958 * Register a new user
960 * This registers a new user - Data is read directly from $_POST
1006 //okay try to create the user
1012 // send notification about the new user
1022 // autogenerated password? then send password to user
1033 * Update user profile
1111 [/* user */, $sticky, /* pass */] = auth_getCookie();
1126 * Delete the current logged-in user
1203 // we're in token phase - get user info from token
1219 $user = io_readfile($tfile);
1220 $userinfo = $auth->getUserData($user, false);
1226 if (!$conf['autopasswd']) { // we let the user choose a password
1237 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1242 $pass = auth_pwgen($user);
1243 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1248 if (auth_sendPassword($user, $pass)) {
1266 $user = trim($auth->cleanUser($INPUT->post->str('login')));
1269 $userinfo = $auth->getUserData($user, false);
1280 io_saveFile($tfile, $user);
1283 $trep = ['FULLNAME' => $userinfo['name'], 'LOGIN' => $user, 'CONFIRM' => $url];
1345 * Set the authentication cookie and add user identification data to the session
1347 * @param string $user username
1352 function auth_setCookie($user, $pass, $sticky)
1360 $USERINFO = $auth->getUserData($user);
1363 $cookie = base64_encode($user) . '|' . ((int) $sticky) . '|' . base64_encode($pass);
1375 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
1385 * Returns the user, (encrypted) password and sticky bit from cookie
1394 [$user, $sticky, $pass] = sexplode('|', $_COOKIE[DOKU_COOKIE], 3, '');
1397 $user = base64_decode($user);
1398 return [$user, $sticky, $pass];