[Catalyst-commits] r8522 - in
trunk/Catalyst-Plugin-Authorization-ACL: .
lib/Catalyst/Plugin/Authorization t/lib
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Tue Oct 14 00:06:23 BST 2008
Author: caelum
Date: 2008-10-14 00:06:23 +0100 (Tue, 14 Oct 2008)
New Revision: 8522
Modified:
trunk/Catalyst-Plugin-Authorization-ACL/Changes
trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm
trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm
Log:
AuthZ::ACL: fix access_denied action support
Modified: trunk/Catalyst-Plugin-Authorization-ACL/Changes
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/Changes 2008-10-12 19:16:12 UTC (rev 8521)
+++ trunk/Catalyst-Plugin-Authorization-ACL/Changes 2008-10-13 23:06:23 UTC (rev 8522)
@@ -1,5 +1,8 @@
Revision history for Perl extension Catalyst::Plugin::Authorization::ACL
+0.10 2008-10-13
+ - fix access_denied action support
+
0.09 2008-08-22
- fix the overwriting of $c->req->args for access_denied handlers
Modified: trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm 2008-10-12 19:16:12 UTC (rev 8521)
+++ trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm 2008-10-13 23:06:23 UTC (rev 8522)
@@ -13,7 +13,7 @@
BEGIN { __PACKAGE__->mk_classdata("_acl_engine") }
-our $VERSION = '0.09';
+our $VERSION = '0.10';
my $FORCE_ALLOW = bless {}, __PACKAGE__ . "::Exception";
@@ -104,13 +104,17 @@
sub acl_access_denied {
my ( $c, $class, $action, $err ) = @_;
+ my $namespace = $action->namespace;
+
if ( my $handler =
- ( $c->get_actions( "access_denied", $action->namespace ) )[-1] )
+ ( $c->get_actions( "access_denied", $namespace ) )[-1] )
{
local $c->{_acl_forcibly_allowed} = undef;
- eval { $c->detach( $handler, [$action, $err] ) };
+ (my $path = $handler->reverse) =~ s!^/?!/!;
+ eval { $c->detach( $path, [$action, $err] ) };
+
return 1 if $c->{_acl_forcibly_allowed};
die $@ || $Catalyst::DETACH;
Modified: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm 2008-10-12 19:16:12 UTC (rev 8521)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp.pm 2008-10-13 23:06:23 UTC (rev 8522)
@@ -30,10 +30,16 @@
}
+sub access_denied : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body($c->res->body . 'denied');
+}
+
sub end : Private {
- my ( $self, $c ) = @_;
- $c->res->body( $c->res->body . ($c->error->[-1] =~ /denied/ ? "denied" : "allowed") );
- $c->error( 0 );
+ my ( $self, $c ) = @_;
+ if ($c->res->body !~ /denied/) {
+ $c->res->body($c->res->body . 'allowed');
+ }
}
__PACKAGE__->config(
More information about the Catalyst-commits
mailing list