line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Dancer::Plugin::Auth::RBAC access control via the Dancer configuration file! |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Dancer::Plugin::Auth::RBAC::Permissions::Config; |
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
|
|
2
|
|
46
|
$Dancer::Plugin::Auth::RBAC::Permissions::Config::VERSION = '1.110720'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
9
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
63
|
|
10
|
2
|
|
|
2
|
|
10
|
use base qw/Dancer::Plugin::Auth::RBAC::Permissions/; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
1270
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub subject_asa { |
14
|
12
|
|
|
12
|
1
|
34
|
my ($self, $options, @arguments) = @_; |
15
|
12
|
|
|
|
|
18
|
my $role = shift @arguments; |
16
|
12
|
|
|
|
|
52
|
my $user = $self->credentials; |
17
|
12
|
|
|
|
|
51895
|
my $settings = $class::settings; |
18
|
|
|
|
|
|
|
|
19
|
12
|
50
|
|
|
|
52
|
if ($role) { |
20
|
12
|
100
|
|
|
|
23
|
if (grep { /$role/ } @{$user->{roles}}) { |
|
9
|
|
|
|
|
174
|
|
|
12
|
|
|
|
|
48
|
|
21
|
3
|
|
|
|
|
34
|
return 1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
9
|
|
|
|
|
86
|
return 0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub subject_can { |
30
|
10
|
|
|
10
|
1
|
24
|
my ($self, $options, @arguments) = @_; |
31
|
10
|
|
|
|
|
14
|
my ($operation, $action) = @arguments; |
32
|
10
|
|
|
|
|
12
|
my $settings = $class::settings; |
33
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
32
|
my $user = $self->credentials; |
35
|
10
|
|
|
|
|
48573
|
my $roles = $options->{control}; |
36
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
15
|
foreach my $role ( @{$user->{roles}} ) { |
|
10
|
|
|
|
|
32
|
|
38
|
|
|
|
|
|
|
|
39
|
15
|
100
|
|
|
|
57
|
if (defined $roles->{$role}->{permissions}) { |
40
|
|
|
|
|
|
|
|
41
|
10
|
|
|
|
|
24
|
my $permissions = $roles->{$role}->{permissions}; |
42
|
10
|
50
|
|
|
|
24
|
if (defined $permissions->{$operation}) { |
43
|
|
|
|
|
|
|
|
44
|
10
|
100
|
|
|
|
19
|
if ($action) { |
45
|
|
|
|
|
|
|
|
46
|
8
|
50
|
|
|
|
23
|
if (defined $permissions->{$operation}->{operations}) { |
47
|
|
|
|
|
|
|
|
48
|
8
|
|
|
|
|
14
|
my $operations = $permissions->{$operation}->{operations}; |
49
|
8
|
100
|
|
|
|
10
|
if (grep { /$action/ } @{$operations}) { |
|
24
|
|
|
|
|
185
|
|
|
8
|
|
|
|
|
18
|
|
50
|
|
|
|
|
|
|
|
51
|
6
|
|
|
|
|
58
|
return 1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
2
|
|
|
|
|
15
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
15
|
return 0; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |