[pmwiki-users] identify current authorization level

Dominique Faure dominique.faure at gmail.com
Tue Aug 1 18:22:54 CDT 2006


On 8/1/06, Henrik Bechmann <henrik at bechmannsoftware.com> wrote:
> Hagan, re:
>
>   if ($action == 'logout')
>
> Then I would have to save state between calls to the server. Do I have
> to rewrite PmWiki to determine what is the current state of edit
> authorization?!?
>
> To review: after some confusion, I am able to determine the *most
> recent* edit authorization, by using the following function in
> farmconfig, and calling it from somewhere within the process, after
> further initialization takes place:
>
> function isEditAuthorized() {
>  global $pagename;
>  $pagename = ResolvePageName($pagename);
>  $editauth = (boolean)RetrieveAuthPage($pagename, 'edit', false,
> READPAGE_CURRENT);
>  return $editauth;
> }
>
> BUT if the user does &action=logout, this function perversely continues
> to return true (until the next edit attempt), which is an incorrect
> result. I am finding it *extremely* difficult to follow the code to find
> out where and how the edit authorization is reset upon (and not before)
> an edit request after logout.
>

when, why not trying to do it more explicitely?

function isEditAuthorized() {
 global $pagename, $action;
 if($action == 'logout') return false;
 $pagename = ResolvePageName($pagename);
 $editauth = (boolean)RetrieveAuthPage($pagename, 'edit', false,
READPAGE_CURRENT);
 return $editauth;
}

Regards,
Dom




More information about the pmwiki-users mailing list