File: Root.pm

package info (click to toggle)
libcatalyst-actionrole-acl-perl 0.07-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 236 kB
  • sloc: perl: 1,874; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package TestChained::Controller::Root;
use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller' };

my $msg = '';

__PACKAGE__->config(
    namespace => q{},
);

sub index :Local Args(0) {
    my ($self, $c) = @_;
    $c->stash->{msg} = 'index';
}

sub stage1
:Chained('/')
:CaptureArgs(0)
:Does('ACL')
:RequiresRole('admin')
:ACLDetachTo('denied')
{
    my ($self, $c) = @_;
    $c->stash->{msg} .= '-stage1';
}

sub stage2
:Chained('stage1')
:CaptureArgs(0)
:Does('ACL')
:RequiresRole('superuser')
:ACLDetachTo('denied')
{
    my ($self, $c) = @_;
    $c->stash->{msg} .= '-stage2';
}

sub edit
:Chained('stage2')
:Does('ACL')
:RequiresRole('editor')
:ACLDetachTo('denied')
:Args(0)
{
    my ($self, $c) = @_;
    $c->stash->{msg} .= '-edit';
    $c->res->body($c->stash->{msg});
}

sub denied :Private {
    my ($self, $c) = @_;

    $c->res->status(403);
    $c->res->body('access denied');
}


__PACKAGE__->meta->make_immutable;