>> Right now we have a "Client" page with a list of our client names. If you 
>> click on a name it is linked to a page that requires a password. Each client 
>> page has a unique password. We're not using AuthUser, just the default attr 
>> for each page.
>>
>> But what we'd like to do is have the password prompt show up as soon as you 
>> click on the main "Clients" page and then depending on the password entered 
>> it would take you to that specific clients page.
>

Here is the solution slightly changed to read from a page:

===(snip config.php)===
Markup('GotoClientPage', 'inline',
       '/\(:goto-client-page:\)/e',
       'GotoClientPage(\$pagename)');
function GotoClientPage($pagename)
{
       $p = ReadPage("Client.Homepages", READPAGE_CURRENT);
       $ClientList = preg_grep("/^[A-Z]\w*.[A-Z]\w*$/", explode("\n",
$p['text']));
       $gotopage = null;
       foreach ($ClientList as $homepage) {
          if (CondAuth($homepage, 'read')) {
             $gotopage = $homepage;
             break;
          }
       }
       if ($gotopage)
          Redirect($gotopage);
}
===(end snip config.php)===

Now Client.Homepages should contain a list of client homepages, one
per line.  Note that nothing except the group.pagename should exist on
the line and both the group and the pagename must start with
upper-case, as is required by pmwiki.  For presentation purposes on
the Client.Homepages you can place a (:linebreaks:) at the top and
since it doesn't match a group.pagename pattern it will be ignored in
terms of the list of homepages.

It sounds like other solutions are meeting your needs - I'm just
throwing this out as an alternative.  The advantages, as I see them,
are (1) passwords are not placed in plaintext, neither in config.php
nor in a page and (2) as a result there is no need to keep page
passwords and an external password list synchronized.  Adding a new
client requires creating the client homepage with the appropriate read
password and adding that homepage to the Client.Homepages page.

-Peter

_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to