[pmwiki-users] identify current authorization level

Patrick R. Michaud pmichaud at pobox.com
Thu Aug 3 10:25:30 CDT 2006

On Tue, Aug 01, 2006 at 05:48:00PM -0400, Henrik Bechmann wrote:
> 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.

Can we restart this question from the beginning?  As you say,
it seems to me that this should be pretty straightforward, but
the answers in the thread seem to be out of proportion to the
problem being solved.

So, can we go back to the original?  I think that one ought to be
able to determine edit authorization by doing:

    $pagename = ResolvePageName($pagename);
    $isEditAuthorized = 
      (boolean)RetrieveAuthPage($pagename, 'edit', false, READPAGE_CURRENT);

Of course, this code has to go *after* any authorization settings;
i.e., after including authuser.php, setting $DefaultPasswords, etc.

If you're wanting to do this from a farmconfig, it's very important
to get the sequencing correct (but it can be done from within the
include files).

The above should work even with ?action=logout, as ?action=logout
already performs its own redirect after clearing the session variables.


> >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