| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# $HeadURL: https://svn.oucs.ox.ac.uk/people/oliver/pub/librpc-serialized-perl/trunk/lib/RPC/Serialized/ACL.pm $ |
|
3
|
|
|
|
|
|
|
# $LastChangedRevision: 1281 $ |
|
4
|
|
|
|
|
|
|
# $LastChangedDate: 2008-10-01 16:16:56 +0100 (Wed, 01 Oct 2008) $ |
|
5
|
|
|
|
|
|
|
# $LastChangedBy: oliver $ |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
package RPC::Serialized::ACL; |
|
8
|
|
|
|
|
|
|
{ |
|
9
|
|
|
|
|
|
|
$RPC::Serialized::ACL::VERSION = '1.123630'; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
1021
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
77
|
|
|
13
|
2
|
|
|
2
|
|
11
|
use warnings FATAL => 'all'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
93
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
1473
|
use RPC::Serialized::ACL::Operation; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
61
|
|
|
16
|
2
|
|
|
2
|
|
1536
|
use RPC::Serialized::ACL::Subject; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
49
|
|
|
17
|
2
|
|
|
2
|
|
1388
|
use RPC::Serialized::ACL::Target; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
55
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
11
|
use constant DECLINE => 0; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
124
|
|
|
20
|
2
|
|
|
2
|
|
9
|
use constant DENY => 1; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
76
|
|
|
21
|
2
|
|
|
2
|
|
8
|
use constant ALLOW => 2; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
921
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
|
24
|
12
|
|
|
12
|
0
|
31
|
my $class = shift; |
|
25
|
12
|
|
|
|
|
48
|
my %args = @_; |
|
26
|
12
|
|
|
|
|
13
|
my $self; |
|
27
|
|
|
|
|
|
|
|
|
28
|
12
|
100
|
66
|
|
|
67
|
if ( defined $args{operation} and ref $args{operation} ) { |
|
29
|
7
|
|
|
|
|
22
|
$self->{OPERATION} = $args{operation}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else { |
|
32
|
5
|
|
|
|
|
30
|
$self->{OPERATION} |
|
33
|
|
|
|
|
|
|
= RPC::Serialized::ACL::Operation->new( $args{operation} ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
12
|
100
|
66
|
|
|
57
|
if ( defined $args{subject} and ref $args{subject} ) { |
|
36
|
7
|
|
|
|
|
13
|
$self->{SUBJECT} = $args{subject}; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
5
|
|
|
|
|
24
|
$self->{SUBJECT} = RPC::Serialized::ACL::Subject->new( $args{subject} ); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
12
|
100
|
66
|
|
|
123
|
if ( defined $args{target} and ref $args{target} ) { |
|
42
|
7
|
|
|
|
|
12
|
$self->{TARGET} = $args{target}; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else { |
|
45
|
5
|
|
|
|
|
25
|
$self->{TARGET} = RPC::Serialized::ACL::Target->new( $args{target} ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
12
|
100
|
66
|
|
|
51
|
if ( defined $args{action} and $args{action} eq 'allow' ) { |
|
48
|
8
|
|
|
|
|
14
|
$self->{ACTION} = ALLOW; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
4
|
|
|
|
|
10
|
$self->{ACTION} = DENY; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
12
|
|
|
|
|
70
|
return bless $self, $class; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub operation { |
|
58
|
79
|
|
|
79
|
0
|
3236
|
my $self = shift; |
|
59
|
79
|
|
|
|
|
316
|
$self->{OPERATION}; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub subject { |
|
63
|
60
|
|
|
60
|
0
|
78
|
my $self = shift; |
|
64
|
60
|
|
|
|
|
229
|
$self->{SUBJECT}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub target { |
|
68
|
44
|
|
|
44
|
0
|
65
|
my $self = shift; |
|
69
|
44
|
|
|
|
|
176
|
$self->{TARGET}; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub action { |
|
73
|
32
|
|
|
32
|
0
|
50
|
my $self = shift; |
|
74
|
32
|
|
|
|
|
197
|
$self->{ACTION}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub check { |
|
78
|
69
|
|
|
69
|
0
|
3474
|
my $self = shift; |
|
79
|
69
|
|
|
|
|
111
|
my ( $subject, $operation, $target ) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
69
|
100
|
100
|
|
|
130
|
return DECLINE |
|
|
|
|
100
|
|
|
|
|
|
82
|
|
|
|
|
|
|
unless $self->operation->match($operation) |
|
83
|
|
|
|
|
|
|
and $self->subject->match($subject) |
|
84
|
|
|
|
|
|
|
and $self->target->match($target); |
|
85
|
|
|
|
|
|
|
|
|
86
|
24
|
|
|
|
|
71
|
return $self->action(); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
|
90
|
|
|
|
|
|
|
|