[pmwiki-users] identify current authorization level

Henrik Bechmann henrik at bechmannsoftware.com
Tue Aug 1 16:48:00 CDT 2006


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.

I'd really appreciate an answer to this. I'm looking at days of effort 
ahead to answer a question that it seems to me should be pretty 
straightforward.

Thanks,

- Henrik

Henrik Bechmann
www.osscommons.ca
www.bechmannsoftware.com
Webmaster, www.dufferinpark.ca



H. Fox wrote:
> On 7/27/06, Henrik Bechmann <henrik at bechmannsoftware.com> wrote:
>> Hagan,
> [...]
>> So it looks like I'll be able to call this function from within my PHP
>> code to decide on layout, BUT...
>>
>> ...there is one more problem.
>>
>> I want isEditAuthorized to return false after action=logout on the page,
>> so that the author can revert to the user page layout (no author menus,
>> etc). But action=logout apparently does not clear the [=auth][edit]
>> value until the next attempt to login (caching?).
>>
>> Is there some way to detect that a logout has taken place?
>
> Try
>
>   if ($action == 'logout') {
>     ## A logout has taken place.
>   }
>
> Maybe this would cause the page to reload?:
>
>   if ($action == 'logout') {
>     header("Location: $ScriptUrl");
>   }
>
> Hagan
>
>




More information about the pmwiki-users mailing list