line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Amazon::S3::ACL::Grant::URI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1240
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
6
|
1
|
|
|
1
|
|
5
|
use English qw( -no_match_vars ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
498
|
use base qw(Net::Amazon::S3::ACL::Grant); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
245
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( URI )); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Module implementation here |
12
|
|
|
|
|
|
|
sub parse_grantee { |
13
|
0
|
|
|
0
|
1
|
|
my ($self, $xpc, $node) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
my $URI = $xpc->findvalue('.//s3:Grantee/s3:URI', $node) |
16
|
|
|
|
|
|
|
or croak 'no URI grant in provided node'; |
17
|
0
|
|
|
|
|
|
$self->URI($URI); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
(my $key = $URI) =~ s{.*/}{}mxs; |
20
|
0
|
0
|
|
|
|
|
$key = |
|
|
0
|
|
|
|
|
|
21
|
|
|
|
|
|
|
($key eq 'AllUsers') ? 'ALL' |
22
|
|
|
|
|
|
|
: ($key eq 'AuthenticatedUsers') ? 'AUTH' |
23
|
|
|
|
|
|
|
: $URI; |
24
|
0
|
|
|
|
|
|
$self->key($key); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} ## end sub _parse_acl_grant |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my (%canonical_key_for, %URI_for); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
BEGIN { |
32
|
1
|
|
|
1
|
|
12
|
%canonical_key_for = ( |
33
|
|
|
|
|
|
|
'AUTHENTICATED' => 'AUTH', |
34
|
|
|
|
|
|
|
'AUTH' => 'AUTH', |
35
|
|
|
|
|
|
|
'ALL' => 'ALL', |
36
|
|
|
|
|
|
|
'ANY' => 'ALL', |
37
|
|
|
|
|
|
|
'ANONYMOUS' => 'ALL', |
38
|
|
|
|
|
|
|
'ANON' => 'ALL', |
39
|
|
|
|
|
|
|
'*' => 'ALL', |
40
|
|
|
|
|
|
|
); |
41
|
1
|
|
|
|
|
295
|
%URI_for = ( |
42
|
|
|
|
|
|
|
AUTH => 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers', |
43
|
|
|
|
|
|
|
ALL => 'http://acs.amazonaws.com/groups/global/AllUsers', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub canonical_key_for { |
48
|
0
|
|
|
0
|
1
|
|
my ($self, $key) = @_; |
49
|
0
|
0
|
|
|
|
|
if (my ($type) = $key =~ m{\A http://.*/(All | Authenticated)Users \z}imxs) { |
50
|
0
|
|
|
|
|
|
$key = $type; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
0
|
|
|
|
|
croak "no canonical name for '$key'" |
53
|
|
|
|
|
|
|
unless exists $canonical_key_for{uc $key}; |
54
|
0
|
|
|
|
|
|
return $canonical_key_for{uc $key}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub populate_from_target { |
58
|
0
|
|
|
0
|
1
|
|
my ($self, $target) = @_; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$target = $self->canonical_key_for($target); |
61
|
0
|
|
|
|
|
|
$self->key($target); |
62
|
0
|
|
|
|
|
|
$self->URI($URI_for{$target}); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _set_key { |
68
|
0
|
|
|
0
|
|
|
$_[0]->key($_[0]->canonical_key_for($_[0]->URI())); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub stringify_grantee { |
72
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
73
|
0
|
|
|
|
|
|
my $URI = $self->URI(); |
74
|
0
|
|
|
|
|
|
return <<"END_OF_GRANTEE"; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$URI |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
END_OF_GRANTEE |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
82
|
|
|
|
|
|
|
__END__ |