[Catalyst-commits] r11424 - in
trunk/Catalyst-Plugin-Authorization-ACL:
lib/Catalyst/Plugin/Authorization/ACL t/lib
t/lib/ACLTestApp/Controller t/lib/ACLTestApp2
t/lib/ACLTestApp2/Controller
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sat Sep 26 03:29:33 GMT 2009
Author: caelum
Date: 2009-09-26 03:29:32 +0000 (Sat, 26 Sep 2009)
New Revision: 11424
Added:
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp/Controller/Root.pm
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/Controller/
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/Controller/Root.pm
Modified:
trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm
Log:
move app actions into root controllers, fix sort indices
Modified: trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm 2009-09-26 03:03:31 UTC (rev 11423)
+++ trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm 2009-09-26 03:29:32 UTC (rev 11424)
@@ -191,7 +191,7 @@
next unless $filter->($action);
my $sort_index =
- 1 + ( $depth - $root_depth )
+ ( $depth - $root_depth )
; # how far an action is from the origin of the ACL
$self->app->log->debug("... $action at sort index $sort_index")
if $self->app->debug;
Added: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp/Controller/Root.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp/Controller/Root.pm 2009-09-26 03:29:32 UTC (rev 11424)
@@ -0,0 +1,29 @@
+package ACLTestApp::Controller::Root;
+
+use base 'Catalyst::Controller';
+__PACKAGE__->config->{namespace} = '';
+
+sub restricted : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( "restricted" );
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( "welcome to the zoo!" );
+
+}
+
+sub access_denied : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body($c->res->body . 'denied');
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+ if ($c->res->body !~ /denied/) {
+ $c->res->body($c->res->body . 'allowed');
+ }
+}
+
+__PACKAGE__;
Modified: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm 2009-09-26 03:03:31 UTC (rev 11423)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm 2009-09-26 03:29:32 UTC (rev 11424)
@@ -19,29 +19,6 @@
use Catalyst::Plugin::Authorization::ACL::Engine qw/$DENIED $ALLOWED/;
-sub restricted : Local {
- my ( $self, $c ) = @_;
- $c->res->body( "restricted" );
-}
-
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->res->body( "welcome to the zoo!" );
-
-}
-
-sub access_denied : Private {
- my ( $self, $c ) = @_;
- $c->res->body($c->res->body . 'denied');
-}
-
-sub end : Private {
- my ( $self, $c ) = @_;
- if ($c->res->body !~ /denied/) {
- $c->res->body($c->res->body . 'allowed');
- }
-}
-
__PACKAGE__->config(
authentication => {
users => {
Added: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/Controller/Root.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2/Controller/Root.pm 2009-09-26 03:29:32 UTC (rev 11424)
@@ -0,0 +1,41 @@
+package ACLTestApp2::Controller::Root;
+
+use base 'Catalyst::Controller';
+__PACKAGE__->config->{namespace} = '';
+
+sub foo : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( $c->res->body . "foo");
+}
+
+sub bar : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body( $c->res->body . "bar");
+}
+
+sub gorch : Local {
+ my ( $self, $c, $frozjob ) = @_;
+ $c->res->body( $c->res->body . "gorch");
+ $c->res->body( $c->res->body . "&frozjob=$frozjob");
+}
+
+sub end : Private {
+ my ( $self, $c ) = @_;
+
+ $c->res->body( join " ",
+ ( $c->stash->{denied} || @{ $c->error } ? "denied" : "allowed" ),
+ $c->res->body );
+}
+
+sub access_denied : Private {
+ my ( $self, $c, $action, $error ) = @_;
+
+ $c->res->header( 'X-Catalyst-ACL-Param-Action' => $action->reverse, 'X-Catalyst-ACL-Param-Error' => $error );
+ $c->res->body( join " ", "handled", $c->res->body );
+
+ $c->stash->{denied} = 1;
+
+ $c->forcibly_allow_access if $c->action->name eq "gorch";
+}
+
+__PACKAGE__;
Modified: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm 2009-09-26 03:03:31 UTC (rev 11423)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm 2009-09-26 03:29:32 UTC (rev 11424)
@@ -6,46 +6,12 @@
use Catalyst qw/
Authorization::ACL
- /;
+/;
-sub foo : Local {
- my ( $self, $c ) = @_;
- $c->res->body( $c->res->body . "foo");
-}
-
-sub bar : Local {
- my ( $self, $c ) = @_;
- $c->res->body( $c->res->body . "bar");
-}
-
-sub gorch : Local {
- my ( $self, $c, $frozjob ) = @_;
- $c->res->body( $c->res->body . "gorch");
- $c->res->body( $c->res->body . "&frozjob=$frozjob");
-}
-
-sub end : Private {
- my ( $self, $c ) = @_;
-
- $c->res->body( join " ",
- ( $c->stash->{denied} || @{ $c->error } ? "denied" : "allowed" ),
- $c->res->body );
-}
-
-sub access_denied : Private {
- my ( $self, $c, $action, $error ) = @_;
-
- $c->res->header( 'X-Catalyst-ACL-Param-Action' => $action->reverse, 'X-Catalyst-ACL-Param-Error' => $error );
- $c->res->body( join " ", "handled", $c->res->body );
-
- $c->stash->{denied} = 1;
-
- $c->forcibly_allow_access if $c->action->name eq "gorch";
-}
-
__PACKAGE__->setup;
__PACKAGE__->deny_access("/");
__PACKAGE__->allow_access("/bar");
+__PACKAGE__;
More information about the Catalyst-commits
mailing list