line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::ACL; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
61503
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
275
|
|
4
|
3
|
|
|
3
|
|
1418
|
use Data::ACL::Realm; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
77
|
|
7
|
3
|
|
|
3
|
|
14
|
use vars qw/ $VERSION /; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1134
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub AddPolicy { |
13
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $realm, @args ) = @_; |
14
|
0
|
|
|
|
|
0
|
my $obj = $self->Realm( $realm ); |
15
|
0
|
|
|
|
|
0
|
return $obj->AddPolicy( @args ); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub IsAuthorized { |
20
|
3
|
|
|
3
|
1
|
6
|
my ( $self, $user, $realm ) = @_; |
21
|
3
|
|
|
|
|
7
|
my $obj = $self->{'realms'}->{$realm}; |
22
|
3
|
50
|
|
|
|
14
|
unless ( UNIVERSAL::isa( $obj, 'Data::ACL::Realm' ) ) { |
23
|
0
|
|
|
|
|
0
|
croak( __PACKAGE__, "->IsAuthorized : Undefined realm or unknown realm object - ", $realm ); |
24
|
|
|
|
|
|
|
} |
25
|
3
|
|
|
|
|
4
|
my $default = $self->{'realms'}->{'all'}; |
26
|
3
|
50
|
|
|
|
11
|
if ( UNIVERSAL::isa( $default, 'Data::ACL::Realm' ) ) { |
27
|
0
|
0
|
|
|
|
0
|
return undef unless $default->IsAuthorized( $user ); |
28
|
|
|
|
|
|
|
} |
29
|
3
|
|
|
|
|
7
|
$obj->IsAuthorized( $user ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub Realm { |
34
|
1
|
|
|
1
|
1
|
387
|
my ( $self, $realm ) = @_; |
35
|
1
|
|
33
|
|
|
14
|
$self->{'realms'}->{$realm} ||= Data::ACL::Realm->new( $self->{'set'} ); |
36
|
1
|
|
|
|
|
4
|
return $self->{'realms'}->{$realm}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub RemovePolicy { |
41
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $realm, @args ) = @_; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
1
|
|
|
1
|
1
|
725
|
my ( $class, $set ) = @_; |
47
|
1
|
|
|
|
|
6
|
my $self = bless { |
48
|
|
|
|
|
|
|
'realms' => {}, |
49
|
|
|
|
|
|
|
'set' => $set |
50
|
|
|
|
|
|
|
}, $class; |
51
|
1
|
|
|
|
|
3
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |