[pmwiki-devel] Localizing changes from IsAuthorized as well as HandleAttr

Patrick R. Michaud pmichaud at pobox.com
Sun Feb 4 10:45:08 CST 2007


On Thu, Feb 01, 2007 at 03:00:04PM -0500, Danny Kimsey wrote:
> Essentially I've added an additonal check to IsAuthorized.
> And redirected the PrintAttrForm to my own function.

The redirect of PrintAttrForm is easy to do from a local customization--
just do:

    $HandleAttrFmt = array(&$PageStartFmt, $&PageAttrFmt,
      'function:PrintAttrCheckboxForm', &$PageEndFmt);

This overrides the default setting in HandleAttr.

I'm not sure of the details of $GL_PERMISSION and $gl_name,
but if I'm reading this patch correctly it looks to me as 
though $GL_PERMISSION[$gl_name] simply contains a list of groups
for which the visitor is a member.  If that's the case, then
I think the following local customization does what you want
without any modifications to pmwiki.php:

    # use $GL_PERMISSION and $gl_name to grant access to
    # specific group names (e.g., '@Supervisor')
    foreach($GL_PERMISSION[$gl_name] as $group => $v)
      if ($v) $AuthList["@$group"] = 1;

$AuthList is what PmWiki's built-in authorization uses to
determine the groups and identities for which the current
visitor is authenticated.  For example, setting 
$AuthList['@Supervisor'] to a positive value means that 
the current visitor is a member of the @Supervisor group.  

So, if we have $GL_PERMISSION[$gl_name]['Supervisor'] as a
true value, then the above loop would cause PmWiki to
treat the visitor as being in the '@Supervisor' authorization
group.

Hope this helps, please let me know if it works.

Pm



More information about the pmwiki-devel mailing list