line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Apache::Sling::GroupUtil; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
32503
|
use 5.008001; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
234
|
|
6
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
116
|
|
7
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
99
|
|
8
|
3
|
|
|
3
|
|
18
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
259
|
|
9
|
3
|
|
|
3
|
|
786
|
use Apache::Sling::URL; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
465
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
17
|
use base qw(Exporter); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
4126
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = (); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.27'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#{{{sub add_setup |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub add_setup { |
22
|
4
|
|
|
4
|
1
|
485
|
my ( $base_url, $act_on_group, $properties ) = @_; |
23
|
4
|
100
|
|
|
|
18
|
if ( !defined $base_url ) { croak 'No base url defined to add against!'; } |
|
1
|
|
|
|
|
27
|
|
24
|
3
|
100
|
|
|
|
12
|
if ( !defined $act_on_group ) { croak 'No group name defined to add!'; } |
|
1
|
|
|
|
|
24
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# property_post_vars is set to q{} if no properties are specified: |
27
|
2
|
|
|
|
|
8
|
my $property_post_vars = |
28
|
|
|
|
|
|
|
Apache::Sling::URL::properties_array_to_string($properties); |
29
|
2
|
|
|
|
|
6
|
my $post_variables = "\$post_variables = [':name','$act_on_group'"; |
30
|
2
|
100
|
|
|
|
8
|
if ( $property_post_vars ne q{} ) { |
31
|
1
|
|
|
|
|
3
|
$post_variables .= ",$property_post_vars"; |
32
|
|
|
|
|
|
|
} |
33
|
2
|
|
|
|
|
3
|
$post_variables .= "]"; |
34
|
|
|
|
|
|
|
return |
35
|
2
|
|
|
|
|
17
|
"post $base_url/system/userManager/group.create.html $post_variables"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#}}} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#{{{sub add_eval |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub add_eval { |
43
|
1
|
|
|
1
|
1
|
73
|
my ($res) = @_; |
44
|
1
|
|
|
|
|
2
|
return ( ${$res}->code eq '200' ); |
|
1
|
|
|
|
|
5
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#}}} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#{{{sub delete_setup |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub delete_setup { |
52
|
3
|
|
|
3
|
1
|
1214
|
my ( $base_url, $act_on_group ) = @_; |
53
|
3
|
100
|
|
|
|
12
|
if ( !defined $base_url ) { |
54
|
1
|
|
|
|
|
11
|
croak 'No base url defined to delete against!'; |
55
|
|
|
|
|
|
|
} |
56
|
2
|
100
|
|
|
|
7
|
if ( !defined $act_on_group ) { croak 'No group name defined to delete!'; } |
|
1
|
|
|
|
|
13
|
|
57
|
1
|
|
|
|
|
3
|
my $post_variables = q{$post_variables = []}; |
58
|
|
|
|
|
|
|
return |
59
|
1
|
|
|
|
|
7
|
"post $base_url/system/userManager/group/$act_on_group.delete.html $post_variables"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#}}} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#{{{sub delete_eval |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub delete_eval { |
67
|
1
|
|
|
1
|
1
|
422
|
my ($res) = @_; |
68
|
1
|
|
|
|
|
2
|
return ( ${$res}->code eq '200' ); |
|
1
|
|
|
|
|
4
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#}}} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#{{{sub exists_setup |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub exists_setup { |
76
|
3
|
|
|
3
|
1
|
1083
|
my ( $base_url, $act_on_group ) = @_; |
77
|
3
|
100
|
|
|
|
14
|
if ( !defined $base_url ) { |
78
|
1
|
|
|
|
|
10
|
croak 'No base url to check existence against!'; |
79
|
|
|
|
|
|
|
} |
80
|
2
|
100
|
|
|
|
6
|
if ( !defined $act_on_group ) { |
81
|
1
|
|
|
|
|
17
|
croak 'No group to check existence of defined!'; |
82
|
|
|
|
|
|
|
} |
83
|
1
|
|
|
|
|
8
|
return "get $base_url/system/userManager/group/$act_on_group.json"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#}}} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#{{{sub exists_eval |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub exists_eval { |
91
|
1
|
|
|
1
|
1
|
414
|
my ($res) = @_; |
92
|
1
|
|
|
|
|
3
|
return ( ${$res}->code eq '200' ); |
|
1
|
|
|
|
|
5
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#}}} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#{{{sub view_setup |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub view_setup { |
100
|
6
|
|
|
6
|
1
|
1924
|
my ( $base_url, $act_on_group ) = @_; |
101
|
6
|
100
|
|
|
|
22
|
if ( !defined $base_url ) { croak 'No base url to view with defined!'; } |
|
2
|
|
|
|
|
20
|
|
102
|
4
|
100
|
|
|
|
14
|
if ( !defined $act_on_group ) { croak 'No group to view defined!'; } |
|
3
|
|
|
|
|
44
|
|
103
|
1
|
|
|
|
|
8
|
return "get $base_url/system/userManager/group/$act_on_group.tidy.json"; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#}}} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#{{{sub view_eval |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub view_eval { |
111
|
2
|
|
|
2
|
1
|
868
|
my ($res) = @_; |
112
|
2
|
|
66
|
|
|
2
|
return ( ${$res}->code eq '200' && ${$res}->content ne q{} ); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
#}}} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |