On Sat, Aug 23, 2008 at 9:56 PM, Peter Bowers <[EMAIL PROTECTED]> wrote:
> There may be a simpler method, but here's how I would go about it:
...
> On Sat, Aug 23, 2008 at 5:27 PM, noskule <[EMAIL PROTECTED]> wrote:
>> Does someone now if/how to assign attributes to a page with a given name.
Sorry, my previous solution had some conceptual problems and some
typos. Try this instead:
===(snip)===
array_unshift($EditFunctions, 'SetAuths');
function SetAuths($pagename, &$page, &$new)
{
if (!preg_match("/\.GroupConfig$/i", $pagename) ||
strstr($new['text'], '@admins')) return;
$new['passwdedit'] = '@admins';
}
===(snip)===
Limitations on this solution:
(1) The first person to create GroupConfig can make changes even
though they are not admin-authenticated.
(2) If someone explicitly changes the edit password to something which
does not include '@admins' then that password will be replaced with
'@admins' every time the page is edited. I.e., there will be no way
to keep '@admins' out of the edit password.
The 2nd is probably OK, but the 1st may be an issue for you... If so,
you might take a look at "the other side" of $EditFunctions and add a
function to the end, perhaps modeled after AutoCreateTargets(), which
would automatically create the GroupConfig page with the password if
it doesn't exist... (This would still not prevent someone creating
the group by creating GROUP.GroupConfig and they still would not need
admin authorization, but at least it would have to be the *first* page
created...)
-Peter
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users