[dokuwiki] Re: $INFO['perm'] not cleared on logout

Andreas Gohr schrieb:
> On Fri, 30 Sep 2005 02:39:11 +0100
> Christopher Arndt <chris.arndt@xxxxxx> wrote:
> 
> 
>>When I log out from my DokuWiki (2009-09-22),  in my template code
>>$INFO['perm'] is still set to the permissions of the user that was
>>logged in.
> 
> 
> Hmm you're right. The $INFO array is built before the logout handling. I
> just added a line to rebuild the array after logout. This should fix
> your problems.

And I think also a note on wiki:tpl:templates is in order, that
$_SERVER['REMOTE_USER'] will still be set to the old username immediately after
logout. So you would have to check $_REQUEST['do'] != 'logout' here as well.

I have the follwing function in my current template helper code, that wraps
this up:

function rb_get_user_info() {
    global $INFO;
    $user = array();
    if ($_REQUEST['do'] == 'logout' or !isset($INFO['userinfo'])) {
        $user['groups'] = array();
    } else {
        $user['groups'] = $INFO['userinfo']['grps'];
        $user['name'] = $_SERVER['REMOTE_USER'];
    }
    array_push($user['groups'], 'ALL');
    return $user;
}

I include the group 'ALL' here in the list of groups, because that makes I
easier to check acces to things that all users have access to.

Chris

Other related posts: