line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Protected;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7038
|
use 5.006;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
72
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01.02';
|
8
|
|
|
|
|
|
|
our $DEBUG = 0;
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Carp;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
897
|
use Class::Maker;
|
|
1
|
|
|
|
|
11924
|
|
|
1
|
|
|
|
|
8
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
1057
|
use Class::Proxy;
|
|
1
|
|
|
|
|
2131
|
|
|
1
|
|
|
|
|
32
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
902
|
use Decision::ACL;
|
|
1
|
|
|
|
|
17956
|
|
|
1
|
|
|
|
|
35
|
|
17
|
1
|
|
|
1
|
|
10
|
use Decision::ACL::Rule;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
18
|
1
|
|
|
1
|
|
5
|
use Decision::ACL::Constants qw(:rule);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
134
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
882
|
use IO::Extended qw(:all);
|
|
1
|
|
|
|
|
1953
|
|
|
1
|
|
|
|
|
506
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $uid;
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Class::Maker::class
|
25
|
|
|
|
|
|
|
{
|
26
|
|
|
|
|
|
|
isa => [qw( Class::Proxy )],
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
public =>
|
29
|
|
|
|
|
|
|
{
|
30
|
|
|
|
|
|
|
hash => [qw( table )],
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
ref => { acl => 'Decision::ACL' },
|
33
|
|
|
|
|
|
|
},
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
default =>
|
36
|
|
|
|
|
|
|
{
|
37
|
|
|
|
|
|
|
events =>
|
38
|
|
|
|
|
|
|
{
|
39
|
|
|
|
|
|
|
method => sub
|
40
|
|
|
|
|
|
|
{
|
41
|
|
|
|
|
|
|
my ( $this, $e, $m, $victim, $args ) = @_;
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $uid = shift @{$args};
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
unless( ACL_RULE_ALLOW eq $this->test_acl( pkg => ref ${ $victim }, method => ${ $m }, uid => $Class::Protected::uid ) )
|
46
|
|
|
|
|
|
|
{
|
47
|
|
|
|
|
|
|
croak sprintf "Die because of ACL restrictions on protected class '%s'. '%s' is rejected to access method '%s'", ref ${ $victim }, $Class::Protected::uid, ${$m} ;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
},
|
50
|
|
|
|
|
|
|
},
|
51
|
|
|
|
|
|
|
},
|
52
|
|
|
|
|
|
|
};
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub add_acl_rule : method
|
55
|
|
|
|
|
|
|
{
|
56
|
0
|
|
|
0
|
0
|
|
my $this = shift;
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my %rule = @_;
|
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $this->acl->push_rule( Decision::ACL::Rule->new( \%rule ) );
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub test_acl : method
|
64
|
|
|
|
|
|
|
{
|
65
|
0
|
|
|
0
|
0
|
|
my $this = shift;
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my %rule = @_;
|
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return $this->acl->run_acl( \%rule );
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
# guard is only working on blessed references (tie interface for Class::Proxy could
|
72
|
|
|
|
|
|
|
# wave this constrain).
|
73
|
|
|
|
|
|
|
1;
|
74
|
|
|
|
|
|
|
__END__
|