[pmwiki-users] Condition Names.

Stirling Westrup sti at pooq.com
Wed Nov 7 20:45:05 CST 2007


DaveG wrote:
> (:if permit ...:)

That's actually a really good suggestion, but since, as Pm pointed out, I can
just do (:if equal {$Action} ... :), we may as well use (:if action ...:) for
the permissions test.

I'm assuming that what follows would be an adequate definition for
(:if action ...:), unless I'm missing something.

  # Test to see if an action is permitted
  $Conditions['action'] = 'NoCache(CondAction($pagename, $condparm))';

  function CondAction($pagename, $condparm)
    { global $HandleAuth;

      @list($level, $pn) = explode(' ', $condparm, 2);
      $level =
        array_key_exists($level,$HandleAuth)
        ? $HandleAuth[$level]
        : $level;
      $pn = ($pn > '') ? MakePageName($pagename, $pn) : $pagename;
      return (boolean)RetrieveAuthPage($pn, $level, false, READPAGE_CURRENT);
    }







More information about the pmwiki-users mailing list