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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Apr 5 19:12:50 EDT 2006


Author: alexmv
Date: Wed Apr  5 19:12:49 2006
New Revision: 815

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

Log:
 r12161 at zoq-fot-pik:  chmrr | 2006-04-05 16:37:39 -0400
  * Listing if actions


Modified: jifty/trunk/lib/Jifty/API.pm
==============================================================================
--- jifty/trunk/lib/Jifty/API.pm	(original)
+++ jifty/trunk/lib/Jifty/API.pm	Wed Apr  5 19:12:49 2006
@@ -13,6 +13,8 @@
 use Jifty::Everything;
 use base qw/Class::Accessor Jifty::Object/;
 
+require Module::Pluggable;
+
 __PACKAGE__->mk_accessors(qw(action_limits));
 
 =head1 METHODS
@@ -29,6 +31,15 @@
 
     $self->reset;
 
+    Module::Pluggable->import(
+        search_path => [
+            Jifty->config->framework('ActionBasePath'),
+            Jifty->config->framework('ApplicationClass') . "::Action",
+            "Jifty::Action"
+        ],
+        sub_name => "_actions",
+    );
+
     return ($self);
 }
 
@@ -42,7 +53,7 @@
 =cut
 
 sub qualify {
-    my $self = shift;
+    my $self   = shift;
     my $action = shift;
 
     my $base_path = Jifty->config->framework('ActionBasePath');
@@ -146,6 +157,7 @@
         or $polarity     eq "deny";
 
     for my $restriction (@restrictions) {
+
         # Don't let the user "allow .*"
         die "For security reasons, Jifty won't let you allow all actions"
             if $polarity eq "allow"
@@ -199,4 +211,16 @@
     return $allow;
 }
 
+=head2 actions
+
+Lists the class names of all of the allowed actions for this Jifty
+application.
+
+=cut
+
+sub actions {
+    my $self = shift;
+    return sort grep { $self->is_allowed($_) } $self->_actions;
+}
+
 1;


More information about the Jifty-commit mailing list