[pmwiki-users] How to determine if a page requires a valid user id or a shared password?

Lars Grau mail at larsgrau.de
Tue Oct 19 13:13:21 CDT 2010


Hi all,

We've recently activated AuthUser and locked all pages with id:* READ password via config.php
Everything works fine, but I'd like to enhance the usability.

I totally understand the mixed concept having user ids/passwords AND shared passwords but our users don't .-)

Let's assume my Main.HomePage has a shared edit password set.
Now when I activate AuthUser, my users are presented the login form twice.
First, to enter their credentials and second to enter the shared password.

What I want to achieve is that the Login Form tells the user exactly what is required.

I've already modified the Site.AuthForm but I'm missing pieces:

How can I determine by ConditionalMarkup if the requested page action requires ...

- a) admin rights (and hence render username AND password field) or
- b) a valid id (and hence render username AND password field) or
- c) a shared password  (and hence render the password field ONLY) 
- d) a shared password OR a valid id  (and hence render username AND password field)

... according to the given action (browse/edit/upload/attr) ?



What I am looking for is somewhat like:

In Site.AuthForm:

(:if authid:)
// user is already authenticated

(:if2 equal {$Action} "edit" :)
// editing is restricted

(:if3 equal {$RequiredPagePermission} "id":)
// editing is restricted to certain user(s)
$[You are logged in but editing the page is only allowed to certain users]

(:elseif3 equal {$RequiredPagePermission} "password":)
// editing is restricted by a shared password
$[You are logged in but editing the page is restricted by a shared password]

(:elseif3 equal {$RequiredPagePermission} "admin":)
// editing is restricted to admins
$[You are logged in but editing the page requires admin rights]

(:else3 :)
// editing is restricted to either certain users or by a shared password
$[You are logged in but editing the page is restricted by a shared password and/or only allowed to certain users]

(:ifend3:)

...
// repeat (:if:) for other actions
...

(:ifend2:)
(:else:)
// user has clicked on "Login"
$[Login]
(:ifend:)



and then hide or show the username field



(:if [ !equal {$RequiredPagePermission} "id" AND !equal {$RequiredPagePermission} "admin":)
(:input text name=authid:)
(:ifend:)

----

Am I on the right track?

How do I fill the {$RequiredPagePermission} condition ???

Thanks in advance and kind regards,

Lars.-


More information about the pmwiki-users mailing list