[Catalyst-commits] r8256 - in trunk/Catalyst-Plugin-Authorization-ACL: . lib/Catalyst/Plugin/Authorization lib/Catalyst/Plugin/Authorization/ACL t t/lib

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Fri Aug 22 15:39:39 BST 2008


Author: bricas
Date: 2008-08-22 15:39:39 +0100 (Fri, 22 Aug 2008)
New Revision: 8256

Added:
   trunk/Catalyst-Plugin-Authorization-ACL/Makefile.PL
Removed:
   trunk/Catalyst-Plugin-Authorization-ACL/Build.PL
Modified:
   trunk/Catalyst-Plugin-Authorization-ACL/Changes
   trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm
   trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm
   trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm
   trunk/Catalyst-Plugin-Authorization-ACL/t/more_live_app.t
Log:
fix the overwriting of $c->req->args for access_denied handlers. other dist fix-ups.

Deleted: trunk/Catalyst-Plugin-Authorization-ACL/Build.PL
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/Build.PL	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/Build.PL	2008-08-22 14:39:39 UTC (rev 8256)
@@ -1,21 +0,0 @@
-use strict;
-use Module::Build;
-
-my $build = Module::Build->new(
-    create_makefile_pl => 'traditional',
-    license            => 'perl',
-    module_name        => 'Catalyst::Plugin::Authorization::ACL',
-    requires           => {
-        'Catalyst' => '5.7',
-
-        'Class::Data::Inheritable' => 0,
-
-        'Class::Throwable'                         => 0,
-        'Tree::Simple::Visitor::FindByPath'        => 0,
-        'Tree::Simple::Visitor::GetAllDescendents' => 0,
-    },
-    create_readme => 1,
-    sign          => 1,
-);
-$build->create_build_script;
-

Modified: trunk/Catalyst-Plugin-Authorization-ACL/Changes
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/Changes	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/Changes	2008-08-22 14:39:39 UTC (rev 8256)
@@ -1,6 +1,9 @@
 Revision history for Perl extension Catalyst::Plugin::Authorization::ACL
 
-0.08    2006-07021 20:01:00
+0.09    2008-08-22
+        - fix the overwriting of $c->req->args for access_denied handlers
+
+0.08    2006-07-21 20:01:00
         - protect ACL::Engine from custom $SIG{__DIE__} handlers
 
 0.07    2006-07-05 23:15:27

Added: trunk/Catalyst-Plugin-Authorization-ACL/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/Makefile.PL	                        (rev 0)
+++ trunk/Catalyst-Plugin-Authorization-ACL/Makefile.PL	2008-08-22 14:39:39 UTC (rev 8256)
@@ -0,0 +1,20 @@
+use inc::Module::Install 0.77;
+
+if ( -e 'MANIFEST.SKIP' ) {
+    system( 'pod2text lib/Catalyst/Plugin/Authorization/ACL.pm > README' );
+}
+
+perl_version '5.008';
+
+name 'Catalyst-Plugin-Authorization-ACL';
+all_from 'lib/Catalyst/Plugin/Authorization/ACL.pm';
+
+requires 'Catalyst::Runtime' => '5.7000';
+requires 'Class::Data::Inheritable';
+requires 'Class::Throwable';
+requires 'Tree::Simple::Visitor::FindByPath';
+requires 'Tree::Simple::Visitor::GetAllDescendents';
+
+test_requires 'Test::More';
+
+WriteAll;

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	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL/Engine.pm	2008-08-22 14:39:39 UTC (rev 8256)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 package Catalyst::Plugin::Authorization::ACL::Engine;
 use base qw/Class::Accessor::Fast Exporter/;
 

Modified: trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/lib/Catalyst/Plugin/Authorization/ACL.pm	2008-08-22 14:39:39 UTC (rev 8256)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 package Catalyst::Plugin::Authorization::ACL;
 use base qw/Class::Data::Inheritable/;
 
@@ -15,7 +13,7 @@
 
 BEGIN { __PACKAGE__->mk_classdata("_acl_engine") }
 
-our $VERSION = "0.08";
+our $VERSION = '0.09';
 
 my $FORCE_ALLOW = bless {}, __PACKAGE__ . "::Exception";
 
@@ -109,10 +107,9 @@
     if ( my $handler =
         ( $c->get_actions( "access_denied", $action->namespace ) )[-1] )
     {
-        local @{ $c->req->args } = ( $action, $err );
         local $c->{_acl_forcibly_allowed} = undef;
 
-        eval { $c->execute($class, $handler) };
+        eval { $c->detach( $handler, [$action, $err] ) };
 
         return 1 if $c->{_acl_forcibly_allowed};
 
@@ -152,7 +149,7 @@
 
 =head1 NAME
 
-Catalyst::Plugin::Authorization::ACL - ACL support for L<Catalyst> applications.
+Catalyst::Plugin::Authorization::ACL - ACL support for Catalyst applications.
 
 =head1 SYNOPSIS
 
@@ -459,18 +456,17 @@
 L<Catalyst::Plugin::Authentication>, L<Catalyst::Plugin::Authorization::Roles>,
 L<http://catalyst.perl.org/calendar/2005/24>
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Yuval Kogman, C<nothingmuch at woobling.org>
+Yuval Kogman E<lt>nothingmuch at woobling.orgE<gt>
 
 Jess Robinson
 
-=head1 COPYRIGHT & LICENCE
+=head1 COPYRIGHT & LICENSE
 
-	Copyright (c) 2005 the aforementioned authors. All rights
-	reserved. This program is free software; you can redistribute
-	it and/or modify it under the same terms as Perl itself.
+Copyright (c) 2008 the aforementioned authors.
 
-=cut
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself. 
 
-
+=cut

Modified: trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/lib/ACLTestApp2.pm	2008-08-22 14:39:39 UTC (rev 8256)
@@ -33,8 +33,9 @@
 }
 
 sub access_denied : Private {
-    my ( $self, $c, $action ) = @_;
+    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;

Modified: trunk/Catalyst-Plugin-Authorization-ACL/t/more_live_app.t
===================================================================
--- trunk/Catalyst-Plugin-Authorization-ACL/t/more_live_app.t	2008-08-22 01:03:54 UTC (rev 8255)
+++ trunk/Catalyst-Plugin-Authorization-ACL/t/more_live_app.t	2008-08-22 14:39:39 UTC (rev 8256)
@@ -10,11 +10,10 @@
 BEGIN {
     eval {
 		require Test::WWW::Mechanize::Catalyst;
-    } or plan 'skip_all' => "A bunch of plugins are required for this test... Look in the source if you really care... $@";
-    plan tests => 12;
+    } or plan 'skip_all' => "Test::WWW::Mechanize::Catalyst required";
+    plan tests => 14;
 }
 
-
 use Test::WWW::Mechanize::Catalyst 'ACLTestApp2';
 
 my $m = Test::WWW::Mechanize::Catalyst->new;
@@ -40,3 +39,5 @@
 
 $m->get_ok( "$u/gorch/wozzle", "get gorch" );
 $m->content_contains( "frozjob=wozzle", "overriden acces has params intact" );
+is( $m->res->header( 'X-Catalyst-ACL-Param-Action' ), 'gorch', '$action param to access_denied' );
+like( $m->res->header( 'X-Catalyst-ACL-Param-Error' ), qr{Access to gorch denied by rule}, '$error param to access_denied' );




More information about the Catalyst-commits mailing list