| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SVN::Access::Resource; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12
|
use 5.006001; |
|
|
1
|
|
|
|
|
2
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
14
|
|
|
5
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
434
|
use Tie::IxHash; |
|
|
1
|
|
|
|
|
3076
|
|
|
|
1
|
|
|
|
|
260
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
31
|
|
|
31
|
1
|
82
|
my ($class, %attr) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# keep our hashes in order. Thanks Kage of HackThisSite.org |
|
15
|
31
|
|
|
|
|
21
|
my (%authorized, $t); |
|
16
|
31
|
|
|
|
|
89
|
$t = tie(%authorized, 'Tie::IxHash'); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# turn hashref into arrayref up front |
|
19
|
31
|
100
|
|
|
|
441
|
if (ref($attr{authorized}) eq "HASH") { |
|
20
|
1
|
|
|
|
|
2
|
$attr{authorized} = [(%{$attr{authorized}})]; |
|
|
1
|
|
|
|
|
3
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# make sure we copy in stuff that was passed. |
|
24
|
31
|
|
|
|
|
25
|
%authorized = (@{$attr{authorized}}); |
|
|
31
|
|
|
|
|
102
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
31
|
|
|
|
|
441
|
$attr{authorized} = \%authorized; |
|
27
|
31
|
|
|
|
|
32
|
$attr{_authorized_tie} = $t; |
|
28
|
|
|
|
|
|
|
|
|
29
|
31
|
|
|
|
|
71
|
return bless(\%attr, $class); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub authorized { |
|
33
|
96
|
|
|
96
|
1
|
87
|
my ($self) = @_; |
|
34
|
96
|
50
|
|
|
|
166
|
if (ref ($self->{authorized}) eq "HASH") { |
|
35
|
96
|
|
|
|
|
321
|
return $self->{authorized}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
0
|
|
|
|
|
0
|
return undef; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub is_authorized { |
|
41
|
0
|
|
|
0
|
0
|
0
|
my ($self, $entity) = @_; |
|
42
|
0
|
0
|
0
|
|
|
0
|
if (defined($self->{authorized}) && exists($self->{authorized}->{$entity})) { |
|
43
|
0
|
|
|
|
|
0
|
return 1; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
0
|
|
|
|
|
0
|
return undef; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub authorize { |
|
49
|
45
|
|
|
45
|
1
|
65
|
my ($self, @rest) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
45
|
100
|
|
|
|
106
|
if ($rest[$#rest] =~ /^\d+$/o) { |
|
52
|
1
|
|
|
|
|
8
|
$self->{_authorized_tie}->Splice($rest[$#rest], 0, @rest[0..$#rest - 1]); |
|
53
|
|
|
|
|
|
|
} else { |
|
54
|
44
|
|
|
|
|
83
|
$self->{_authorized_tie}->Push(@rest); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub deauthorize { |
|
59
|
0
|
|
|
0
|
1
|
0
|
my ($self, $entity) = @_; |
|
60
|
0
|
0
|
|
|
|
0
|
delete ($self->{authorized}->{$entity}) if ref($self->{authorized}); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub name { |
|
64
|
260
|
|
|
260
|
1
|
186
|
my ($self) = @_; |
|
65
|
260
|
|
|
|
|
952
|
return $self->{name}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
__END__ |