line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Dancer::Plugin::Auth::RBAC Permissions base class and guide! |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Dancer::Plugin::Auth::RBAC::Permissions; |
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
|
|
2
|
|
33
|
$Dancer::Plugin::Auth::RBAC::Permissions::VERSION = '1.110720'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
9
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
49
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
10
|
use Dancer qw/:syntax/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
22
|
|
|
22
|
0
|
50
|
my $class = shift; |
16
|
22
|
|
|
|
|
39
|
my $self = {}; |
17
|
22
|
|
|
|
|
61
|
bless $self, $class; |
18
|
22
|
|
|
|
|
140
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub credentials { |
22
|
22
|
|
|
22
|
0
|
32
|
my $self = shift; |
23
|
22
|
50
|
|
|
|
60
|
if (@_) { |
24
|
0
|
|
|
|
|
0
|
return session 'user' => @_; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
22
|
|
|
|
|
78
|
return session('user'); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub permissions { |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
0
|
0
|
|
|
|
|
if (@_) { |
34
|
0
|
|
|
|
|
|
return session 'roles' => @_; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
0
|
|
|
|
|
|
return session('roles'); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub errors { |
42
|
0
|
|
|
0
|
0
|
|
my ($self, @errors) = @_; |
43
|
0
|
|
|
|
|
|
my $user = session('user'); |
44
|
0
|
|
|
|
|
|
push @{$user->{error}}, @errors; |
|
0
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return session 'user' => $user; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |