[pmwiki-users] meaning of "=protectsafe" (was: (:pagelist:) broken ...)

Patrick R. Michaud pmichaud at pobox.com
Sun May 20 09:10:38 CDT 2007


On Sun, May 20, 2007 at 04:00:07PM +0200, ThomasP wrote:
> On Sun, May 20, 2007 14:35, ThomasP wrote:
> > But the question for me is how should I set
> > $page['=passwd'] such that in the end the behaviour of (:pagelist:) is
> > acceptable:
> >
> >    if (!$page['=passwd']['read']) $opt['=protectsafe'][$pn] = 1;
> >
> > I would readily implement this straight as you said (something equivalent
> > to "Is there any user who may not read the page?"), but it would take a
> > while, as all user records would have to be scanned.

Yes, this does make it tricky.  

> > Therefore my seek for some simplification, and therefore the question for
> > the meaning, especially of "protectsafe". There will be some specific
> > reason why one would like to know whether ANY read restriction exists on
> > the page concerned.
> 
> Ok, I can see now: it is an optimization for not having to look up for
> every single user whether the page is read-allowed for him/her, but rather
> to decide by the once determined feature that no read password is set.

Exactly.

> I will set $page['=passwd']['read'] to "1" whenever the page may not be
> read by the GuestUser group.

This works.  Another approach might be to simply set $page['=passwd']['read']
to '1' for all accesses.  This would then inform pagelist (and other
functions that have a need to check read permission) that there may be 
some read protection on the page.

Another approach I could use is that pagelist and other functions assume
that a page has a password unless $page['=passwd']['read'] is explicitly
set to an empty string.  Then authorization functions that don't set
$page['=passwd']['read'] will still work properly (but perhaps reduce
the amount of caching that gets performed).

Pm



More information about the pmwiki-users mailing list