| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catalyst::Action::Role::ACL; |
|
2
|
1
|
|
|
1
|
|
2424
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use namespace::autoclean; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Catalyst::Action'; |
|
6
|
|
|
|
|
|
|
with 'Catalyst::ActionRole::ACL'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use vars qw($VERSION); |
|
9
|
|
|
|
|
|
|
$VERSION = '0.07'; # Note - Remember to keep in sync with Catalyst::ActionRole::ACL |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
{ |
|
12
|
|
|
|
|
|
|
my $has_warned = 0; |
|
13
|
|
|
|
|
|
|
after BUILD => sub { |
|
14
|
|
|
|
|
|
|
my ($c) = @_; |
|
15
|
|
|
|
|
|
|
my $app = blessed($c) ? blessed($c) : $c; |
|
16
|
|
|
|
|
|
|
warn("Catalyst::Action::Role::ACL in $app is deprecated, please move you code to use Catalyst::ActionRole::ACL\n") |
|
17
|
|
|
|
|
|
|
unless $has_warned++; |
|
18
|
|
|
|
|
|
|
}; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Catalyst::Action::Role::ACL - Deprecated user role-based authorization action class |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub foo |
|
30
|
|
|
|
|
|
|
:Local |
|
31
|
|
|
|
|
|
|
:ActionClass(Role::ACL) |
|
32
|
|
|
|
|
|
|
:RequiresRole(admin) |
|
33
|
|
|
|
|
|
|
:ACLDetachTo(denied) |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
|
|
|
|
|
|
my ($self, $c) = @_; |
|
36
|
|
|
|
|
|
|
... |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub denied :Private { |
|
40
|
|
|
|
|
|
|
my ($self, $c) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$c->res->status('403'); |
|
43
|
|
|
|
|
|
|
$c->res->body('Denied!'); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Provides a L<Catalyst reusable action|Catalyst::Manual::Actions> for user |
|
49
|
|
|
|
|
|
|
role-based authorization. ACLs are applied via the assignment of attributes to |
|
50
|
|
|
|
|
|
|
application action subroutines. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
You are better using L<Catalyst::ActionRole::ACL> to do this, as it plays |
|
53
|
|
|
|
|
|
|
nicely with other extensions. This package is maintained to allow compatibility |
|
54
|
|
|
|
|
|
|
with people using this in existing code, but will warn once when used. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
David P.C. Wollmann E<lt>converter42@gmail.comE<gt> |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 BUGS |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This is new code. Find the bugs and report them, please. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright 2009 by David P.C. Wollmann |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
|
69
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|