[pmwiki-users] Determine whether the visitor is logged in
Peter Brink
peter.brink at brinkdata.se
Thu May 5 08:18:14 CDT 2005
Hans skrev:
> Thursday, May 5, 2005, 1:27:18 PM, Peter wrote:
>
>> I'd like to know this too. For example, I'd like to be able to adapt
>> the items in an action list based on whether the user is logged in or
>> not. Using the new (since beta29) authentification system I'm able to
>> test whether or not the user is logged in as admin. I'd like to be
>> able to write a conditional markup such as for example:
>>(:if isauthenticated true:) Blah, Blah (:ifend:).
>
>
>
> see http://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup
>
> you can use (:if auth admin :).... (:if auth edit :) ..... etc
Ok. But let's say that the user is not yet logged in, and I have a top
menu such as:
(:if auth edit:)[[{$Name}?action=edit | Redigera sida]] |
[[{$Name}?action=attr | Egenskaper ]] | [[{$Name}?action=diff |
Sidhistorik]] | [[PmWiki/DocumentationIndex | Wiki hjälp ]] |
(:ifend:)[[{$Name}?action=print | Skriv ut]]
Then the a user with edit rights will not see a edit link before logging
in, so you would like to have something like:
(:if ! isauthentificated:) [[Main.Loggin | Loggin]](:ifend:)
otherwise you will end up with a moment 22 - you can't (easily)
authenificate yourself because there's no action link that requests
authentification information.
I have already run into this problem and presently I solve it by having
a Loggin page which is read protected, thus forcing me to logg in. By
bookmarking that page I can logg in to the site and still present an
action link less appearance to the casual viewer. See
http://www.rollspelshornan.se for an example. The problem with that
approach is that I need to add any editor to the list of read
authentificated users of the loggin page, which can easily become an hassle.
/Peter Brink
More information about the pmwiki-users
mailing list