line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Apache::Sling::GroupMemberUtil; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
26947
|
use 5.008001; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
71
|
|
6
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
52
|
|
8
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
160
|
|
9
|
2
|
|
|
2
|
|
544
|
use Apache::Sling::URL; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
8
|
use base qw(Exporter); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
872
|
|
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
|
1356
|
my ( $base_url, $act_on_group, $add_member ) = @_; |
23
|
4
|
100
|
|
|
|
18
|
if ( !defined $base_url ) { croak 'No base url defined to add against!'; } |
|
1
|
|
|
|
|
46
|
|
24
|
3
|
100
|
|
|
|
12
|
if ( !defined $act_on_group ) { |
25
|
1
|
|
|
|
|
25
|
croak 'No group name defined to add to!'; |
26
|
|
|
|
|
|
|
} |
27
|
2
|
100
|
|
|
|
6
|
if ( !defined $add_member ) { croak 'Group addition detail missing!'; } |
|
1
|
|
|
|
|
10
|
|
28
|
1
|
|
|
|
|
3
|
my $post_variables = |
29
|
|
|
|
|
|
|
"\$post_variables = [':member','/system/userManager/user/$add_member']"; |
30
|
|
|
|
|
|
|
return |
31
|
1
|
|
|
|
|
10
|
"post $base_url/system/userManager/group/$act_on_group.update.html $post_variables"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#}}} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#{{{sub add_eval |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub add_eval { |
39
|
1
|
|
|
1
|
1
|
69
|
my ($res) = @_; |
40
|
1
|
|
|
|
|
2
|
return ( ${$res}->code eq '200' ); |
|
1
|
|
|
|
|
3
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#}}} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#{{{sub delete_setup |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub delete_setup { |
48
|
5
|
|
|
5
|
1
|
2448
|
my ( $base_url, $act_on_group, $delete_member ) = @_; |
49
|
5
|
100
|
|
|
|
15
|
if ( !defined $base_url ) { |
50
|
1
|
|
|
|
|
11
|
croak 'No base url defined to delete against!'; |
51
|
|
|
|
|
|
|
} |
52
|
4
|
100
|
|
|
|
10
|
if ( !defined $act_on_group ) { |
53
|
2
|
|
|
|
|
25
|
croak 'No group name defined to delete from!'; |
54
|
|
|
|
|
|
|
} |
55
|
2
|
100
|
|
|
|
4
|
if ( !defined $delete_member ) { |
56
|
1
|
|
|
|
|
9
|
croak 'Group deletion detail missing!'; |
57
|
|
|
|
|
|
|
} |
58
|
1
|
|
|
|
|
4
|
my $post_variables = |
59
|
|
|
|
|
|
|
"\$post_variables = [':member\@Delete','/system/userManager/user/$delete_member']"; |
60
|
|
|
|
|
|
|
return |
61
|
1
|
|
|
|
|
7
|
"post $base_url/system/userManager/group/$act_on_group.update.html $post_variables"; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#}}} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#{{{sub delete_eval |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub delete_eval { |
69
|
2
|
|
|
2
|
1
|
787
|
my ($res) = @_; |
70
|
2
|
|
66
|
|
|
3
|
return ( ${$res}->code eq '200' && ${$res}->content ne q{} ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#}}} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |