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