[pmwiki-devel] testing auth level in a recipe

Simon nzskiwi at gmail.com
Fri Mar 18 00:07:45 PDT 2022


Thanks very much.

I should have said "within" the recipe, but this does function does exactly
what I need,
and the page variable is a bonus

cheers

Simon





On Fri, 18 Mar 2022 at 12:58, Dominique Faure <dominique.faure at gmail.com>
wrote:

> Hi,
>
> The following code defines a markup variable that you may use in a
> test to render content accordingly:
>
> =====8<- - - - -
> function PmWikiAuthLevel($pagename) {
>   global $AuthLevels;
>   SDV($AuthLevels, array('admin', 'edit', 'read'));
>   foreach($AuthLevels as $level)
>     if(RetrieveAuthPage($pagename, $level, false, READPAGE_CURRENT))
> return $level;
>   return '(none)';
> }
> $FmtPV['$AuthLevel'] = 'PmWikiAuthLevel($pn)';
> =====8<- - - - -
>
> Regards,
>
> On Thu, Mar 17, 2022 at 10:36 AM Simon <nzskiwi at gmail.com> wrote:
> >
> > I want to test the auth level of the page a recipe is on to restrict
> some output if it is not operating at admin or edit level
> >
> > I've seen CondAuth, but wonder if there is another way
> >
> > ngā mihi
> >
> > Simon
> > _______________________________________________
> > pmwiki-devel mailing list
> > pmwiki-devel at pmichaud.com
> > http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20220318/b7a7d7f6/attachment.html>


More information about the pmwiki-devel mailing list