Re: [pmwiki-users] Condition Names.

2007-11-07 Thread Stirling Westrup
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);
}





___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Condition Names.

2007-11-07 Thread Stirling Westrup
Patrick R. Michaud wrote:
 The normal way to test for the current action is
 
(:if equal {$Action} ... :)

For some reason, that had never occurred to me...

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Condition Names.

2007-11-07 Thread Stirling Westrup
I've just checked, and there is currently no (:if action:) test in the core to
see if one has permission to perform a given action.

See a recent discussion here with PM about how (:if auth:) doesn't quite do
that, as it ignores the $HandleAuth array.

It shouldn't be too hard to add such a test, but what should it be called? The
reason I ask is that I already have a custom (:if action:) test which instead
checks to see what the current value of $action is.

They can't both have the same name, so what should I call them? I'm currently
thinking:

  (:if authact ...:) to see if an action is authorized
  (:if action ...:) to see what the current action is.

What do folks think?

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Condition Names.

2007-11-07 Thread DaveG
(:if permit ...:)

Stirling Westrup wrote:
 I've just checked, and there is currently no (:if action:) test in the core to
 see if one has permission to perform a given action.
 
 See a recent discussion here with PM about how (:if auth:) doesn't quite do
 that, as it ignores the $HandleAuth array.
 
 It shouldn't be too hard to add such a test, but what should it be called? The
 reason I ask is that I already have a custom (:if action:) test which instead
 checks to see what the current value of $action is.
 
 They can't both have the same name, so what should I call them? I'm currently
 thinking:
 
   (:if authact ...:) to see if an action is authorized
   (:if action ...:) to see what the current action is.
 
 What do folks think?
 
 ___
 pmwiki-users mailing list
 pmwiki-users@pmichaud.com
 http://www.pmichaud.com/mailman/listinfo/pmwiki-users
 

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Condition Names.

2007-11-07 Thread Patrick R. Michaud
On Wed, Nov 07, 2007 at 08:23:32PM -0500, Stirling Westrup wrote:
 I've just checked, and there is currently no (:if action:) test in the core to
 see if one has permission to perform a given action.
 
 See a recent discussion here with PM about how (:if auth:) doesn't quite do
 that, as it ignores the $HandleAuth array.
 
 It shouldn't be too hard to add such a test, but what should it be called? The
 reason I ask is that I already have a custom (:if action:) test which instead
 checks to see what the current value of $action is.
 
 They can't both have the same name, so what should I call them? I'm currently
 thinking:
 
   (:if authact ...:) to see if an action is authorized
   (:if action ...:) to see what the current action is.

In the past we've discussed that (:if action ...:) would be true
if someone is permitted to perform a particular action.  We could
change it to (:if authact ...:), however.

The normal way to test for the current action is

   (:if equal {$Action} ... :)

Pm

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users