[pmwiki-users] AuthUser

Peter Bowers pbowers at pobox.com
Mon May 2 11:53:30 CDT 2011


On Sun, May 1, 2011 at 11:08 PM, James M <jamesm1415 at gmail.com> wrote:
...
> I defined in SiteAdmin/AuthUser some groups
> @editors - people who can edit all groups
> @friends - people who can edit a certain group
> @foe - people who can edit a second group
> (in fact there are 6 groups, each with its own group of editors)
>
> In local/config.php I defined $DefaultPasswords['edit'] = '@editors';
> At this stage members of the @editors group could edit everything, but
> no-one else could edit everything, as I expected.
>
> Next, for each of the groups I went to each Group/GroupAttributes&action=attr
> and put @friends in the edit field of the first, @foe in that of the second etc.
>
> The result seemed to be then that members of the @editors group were
> no longer able to edit any group.  Is this right?  Does one really
> need to go through each group and put @editors (as well as @friends
> etc) in the edit field?

Randy has already nicely explained how AuthUser works and how it's
meant to be configured.

Just for another perspective I find that in situations like this I
tend to be "FTP-administrator-oriented" and make changes like this in
my config.php rather than doing them in the
GroupAttributes?action=attr section.  I just find it hard to remember
when I've got a complicated setup with config spread across multiple
locations and it's easier for me when it's all in one place.  So I end
up with something like this:

## Get the group and page name
$pagename = ResolvePageName($pagename);
#$page = PageVar($pagename, '$FullName'); // not needed for this example
$group = PageVar($pagename, '$Group');
#$name = PageVar($pagename, '$Name'); // not needed for this example
...
$DefaultPasswords['edit'] = array('@editors'); // note the array(...)
if (inlist($group, array('GroupA', 'GroupB', 'GroupC')))
   $DefaultPasswords['edit'][] = '@friends';
elseif (inlist($group, array('GroupD', 'GroupE')))
   $DefaultPasswords['edit'][] = '@foes';
...

I've gotten the first 5 lines (before the ... ellipse) from
http://www.pmwiki.org/wiki/PmWiki/LocalCustomizations#configphp-group-page.
 Do note the warning there re caching problems that come if you don't
respect the appropriate order of customizations in config.php as
documented on that same page at
http://www.pmwiki.org/wiki/PmWiki/LocalCustomizations#configphp-order
(the last question on the page).

This business of putting everything in config.php is probably not the
preferred way.  Either using the ?action=attr or at least putting it
in GroupName.php instead of config.php seems to be "the pmwiki way".
But I always forget when I don't keep it in one central location, so I
opt for the centralized control.  YMMV.

Caveat: this is not code taken from an actual config.php, so there may
well be problems here.  I'm just showing you the general approach I
would take to a problem like this.

-Peter



More information about the pmwiki-users mailing list