Lines Matching defs:user
7 * a user by calling auth_login()
71 // degrade to unauthenticated user
82 // Populate Basic Auth user/password from Authorization header
97 // apply cleaning (auth specific user names, remove control chars)
114 'user' => $INPUT->str('u'),
130 * Loads the ACL setup and handle user wildcards
153 // substitute user wildcard first (its 1:1)
155 // if user is not logged in, this ACL line is meaningless - skip it
164 // if user is not logged in, grps is empty, no output will be added (i.e. skipped)
233 // fetch user info from backend
234 $user = $authtoken->getUser();
235 $USERINFO = $auth->getUserData($user);
238 // the code is correct, set up user
239 $INPUT->server->set('REMOTE_USER', $user);
240 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
257 $evdata['user'],
265 * This tries to login the user based on the sent auth credentials
268 * a new login is assumed and user/password are checked. If they
276 * no further testing is done and the user is accepted
285 * @param string $user Username
294 function auth_login($user, $pass, $sticky = false, $silent = false)
306 if (!empty($user)) {
308 if (!empty($pass) && $auth->checkPass($user, $pass)) {
310 $INPUT->server->set('REMOTE_USER', $user);
312 auth_setCookie($user, auth_encrypt($pass, $secret), $sticky);
325 [$user, $sticky, $pass] = auth_getCookie();
326 if ($user && $pass) {
334 $auth->useSessionCache($user) &&
336 ($session['user'] == $user) &&
341 $INPUT->server->set('REMOTE_USER', $user);
349 return auth_login($user, $pass, $sticky, true);
502 * Log out the current user
504 * This clears all authentication data and thus log the user
523 if (isset($_SESSION[DOKU_COOKIE]['auth']['user']))
524 unset($_SESSION[DOKU_COOKIE]['auth']['user']);
549 * Check if a user is a manager
552 * user.
556 * @param string $user Username
557 * @param array $groups List of groups the user is in
558 * @param bool $adminonly when true checks if user is admin
565 function auth_ismanager($user = null, $groups = null, $adminonly = false, $recache = false)
576 if (is_null($user)) {
580 $user = $INPUT->server->str('REMOTE_USER');
584 // checking the logged in user, or another one?
585 if ($USERINFO && $user === $INPUT->server->str('REMOTE_USER')) {
588 $groups = $auth->getUserData($user);
595 $cachekey = serialize([$user, $adminonly, $groups]);
598 $ok = auth_isMember($conf['superuser'], $user, $groups);
602 $ok = auth_isMember($conf['manager'], $user, $groups);
612 * Check if a user is admin
618 * @param string $user Username
619 * @param array $groups List of groups the user is in
626 function auth_isadmin($user = null, $groups = null, $recache = false)
628 return auth_ismanager($user, $groups, true, $recache);
632 * Match a user and his groups against a comma separated list of
638 * @param string $user user to match against
639 * @param array $groups groups the user is member of
642 function auth_isMember($memberlist, $user, array $groups)
648 // clean user and groups
650 $user = PhpString::strtolower($user);
653 $user = $auth->cleanUser($user);
671 if ($member == $user) return true;
682 * This checks the permissions for the current user
701 * Returns the maximum rights a user has for the given ID or its namespace
707 * @param string $user Username
708 * @param array|null $groups Array of groups the user is in
711 function auth_aclcheck($id, $user, $groups)
715 'user' => $user,
735 $user =& $data['user'];
751 //if user is superuser or in superusergroup return 255 (acl_admin)
752 if (auth_isadmin($user, $groups)) {
757 $user = PhpString::strtolower($user);
760 $user = auth_nameencode($auth->cleanUser($user));
775 if ($user) $groups[] = $user;
849 * Some auth backends allow special chars in their user and groupnames
947 * Sends a password to the given user
951 * @param string $user Login name of the user
955 function auth_sendPassword($user, $password)
962 $user = $auth->cleanUser($user);
963 $userinfo = $auth->getUserData($user, false);
970 'LOGIN' => $user,
982 * Register a new user
984 * This registers a new user - Data is read directly from $_POST
1030 //okay try to create the user
1036 // send notification about the new user
1046 // autogenerated password? then send password to user
1057 * Update user profile
1135 [/* user */, $sticky, /* pass */] = auth_getCookie();
1150 * Delete the current logged-in user
1227 // we're in token phase - get user info from token
1243 $user = io_readfile($tfile);
1244 $userinfo = $auth->getUserData($user, false);
1250 if (!$conf['autopasswd']) { // we let the user choose a password
1261 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1266 $pass = auth_pwgen($user);
1267 if (!$auth->triggerUserMod('modify', [$user, ['pass' => $pass]])) {
1272 if (auth_sendPassword($user, $pass)) {
1290 $user = trim($auth->cleanUser($INPUT->post->str('login')));
1293 $userinfo = $auth->getUserData($user, false);
1304 io_saveFile($tfile, $user);
1307 $trep = ['FULLNAME' => $userinfo['name'], 'LOGIN' => $user, 'CONFIRM' => $url];
1380 * Set the authentication cookie and add user identification data to the session
1382 * @param string $user username
1387 function auth_setCookie($user, $pass, $sticky)
1395 $USERINFO = $auth->getUserData($user);
1398 $cookie = base64_encode($user) . '|' . ((int) $sticky) . '|' . base64_encode($pass);
1410 $_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
1420 * Returns the user, (encrypted) password and sticky bit from cookie
1429 [$user, $sticky, $pass] = sexplode('|', $_COOKIE[DOKU_COOKIE], 3, '');
1432 $user = base64_decode($user);
1433 return [$user, $sticky, $pass];