[Jifty-commit] r4919 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 24 06:18:50 EST 2008


Author: sartak
Date: Thu Jan 24 06:18:49 2008
New Revision: 4919

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/API.pm

Log:
 r50708 at onn:  sartak | 2008-01-24 06:18:02 -0500
 Allowing actions also shows them. Fix the defaults so that "weird" actions
 (such as Jifty::Action) are hidden.


Modified: jifty/trunk/lib/Jifty/API.pm
==============================================================================
--- jifty/trunk/lib/Jifty/API.pm	(original)
+++ jifty/trunk/lib/Jifty/API.pm	Thu Jan 24 06:18:49 2008
@@ -116,8 +116,8 @@
 
 Resets which actions are allowed to the defaults; that is, all of the
 application's actions, L<Jifty::Action::Autocomplete>, and
-L<Jifty::Action::Redirect> are allowed; everything else is denied. All actions
-are visible. See L</restrict> for the details of how limits are processed.
+L<Jifty::Action::Redirect> are allowed and visible; everything else is denied
+and hidden. See L</restrict> for the details of how limits are processed.
 
 =cut
 
@@ -129,13 +129,11 @@
 
     # These are the default action limits
     $self->action_limits(
-        [   { show => 1, restriction => qr/.*/ },
-            { deny => 1, restriction => qr/.*/ },
-            {   allow       => 1,
-                restriction => qr/^\Q$app_actions\E/,
-            },
-            { allow => 1, restriction => 'Jifty::Action::Autocomplete' },
-            { allow => 1, restriction => 'Jifty::Action::Redirect' },
+        [
+            { hide => 1, deny => 1, restriction => qr/.*/ },
+            { allow => 1, show => 1, restriction => qr/^\Q$app_actions\E/ },
+            { allow => 1, show => 1, restriction => 'Jifty::Action::Autocomplete' },
+            { allow => 1, show => 1, restriction => 'Jifty::Action::Redirect' },
         ]
     );
 }
@@ -146,6 +144,8 @@
 to the list of limits for the purposes of L</is_allowed>.  See
 L</restrict> for the details of how limits are processed.
 
+Allowing actions also L</show> them.
+
 =cut
 
 sub allow {
@@ -172,6 +172,8 @@
 to the list of limits for the purposes of L</is_visible>.  See
 L</restrict> for the details of how limits are processed.
 
+Hiding actions also L</deny> them.
+
 =cut
 
 sub hide {
@@ -253,6 +255,12 @@
             push @{ $self->action_limits },
                 { deny => 1, restriction => $restriction };
         }
+
+        # Allowing an action also shows it
+        if ($polarity eq 'allow') {
+            push @{ $self->action_limits },
+                { show => 1, restriction => $restriction };
+        }
     }
 }
 


More information about the Jifty-commit mailing list