che::Sling::Content;
use Apache::Sling::GroupMember;
use Apache::Sling::Group;
use Apache::Sling::JsonQueryServlet;
use Apache::Sling::LDAPSynch;
use Apache::Sling::User;
# Fail if args are empty or
he::Sling::GroupMember',
'group', 'Apache::Sling::Group',
'json_query_servlet', 'Apache::Sling::JsonQueryServlet',
'ldap_synch', 'Apache::Sling::LDAPSynch',
'user'
run group membership related actions
group - run group related actions
json_query_servlet - run json query servlet related actions
ldap_synch - run ldap synchronization related
ase verbosity of output.
--view or -V (actOnGroup) - view details for specified group in json format.
Options may be merged together. -- stops processing of options.
Space is not required be
to v2:
perl $0 -U http://localhost:8080 -a -r /test -P p1=v1 -P p2=v2 -u admin -p admin
* View json for node at /test:
perl $0 -U http://localhost:8080 -V -r /test
* Check whether node at /test
ontent->set_results( "$message", $res );
return $success;
}
#}}}
#{{{sub view_full_json
sub view_full_json {
my ( $content, $remote_dest ) = @_;
if ( !defined $remote_dest ) {
cr
ck existence of defined!';
}
return "get $base_url/system/userManager/group/$act_on_group.json";
}
#}}}
#{{{sub exists_eval
sub exists_eval {
my ($res) = @_;
return ( ${$res}->code
group to view defined!'; }
return "get $base_url/system/userManager/group/$act_on_group.tidy.json";
}
#}}}
#{{{sub view_eval
sub view_eval {
my ($res) = @_;
return ( ${$res}->code eq '
l_setup
Returns a textual representation of the request needed to retrieve the ACL for
a node in JSON format.
=cut
sub get_acl_setup {
my ( $base_url, $remote_dest ) = @_;
croak "No base ur
to view ACL for defined!" unless defined $remote_dest;
return "get $base_url/$remote_dest.acl.json";
}
#}}}
#{{{sub get_acl_eval
=pod
=head2 get_acl_eval
Inspects the result returned from iss
e_setup
Returns a textual representation of the request needed to retrieve the ACL for
a node in JSON format.
=cut
sub delete_setup {
my ( $base_url, $remote_dest, $principal ) = @_;
croak
- view the full script documentation.
--me or -m - me returns json representing authenticated user.
--new-password or -n (newPassword) - Used with -c, new passwor
se verbosity of output.
--view or -V (actOnUser) - view details for specified user in json format.
Options may be merged together. -- stops processing of options.
Space is not required be
up;
use 5.008001;
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config bundling);
use JSON;
use Text::CSV;
use Apache::Sling;
use Apache::Sling::GroupUtil;
use Apache::Sling::Print;
use Ap
ase verbosity of output.
--view or -V (actOnGroup) - view details for specified group in json format.
Options may be merged together. -- stops processing of options.
Space is not required be
er;
use 5.008001;
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config bundling);
use JSON;
use Text::CSV;
use Apache::Sling;
use Apache::Sling::GroupUtil;
use Apache::Sling::GroupMemberUt
g::GroupUtil::view_eval($res);
my $message;
if ($success) {
my $group_info = from_json( ${$res}->content );
my $is_member = 0;
foreach my $member ( @{ $group_info->{'m
roupUtil::view_eval($res);
my $message;
if ($success) {
my $group_info = from_json( ${$res}->content );
my $number_members = @{ $group_info->{'members'} };
my $memb
existence of defined!';
}
return "get $base_url/system/userManager/user/$act_on_user.tidy.json";
}
#}}}
#{{{sub exists_eval
sub exists_eval {
my ($res) = @_;
return ( ${$res}->code
package Apache::Sling::JsonQueryServlet;
use 5.008001;
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config bundling);
use Apache::Sling;
use Apache::Sling::JsonQueryServletUtil;
use Apa
authn provided!'; }
my $response;
$verbose = ( defined $verbose ? $verbose : 0 );
my $json_query_servlet = {
BaseURL => ${$authn}->{'BaseURL'},
Authn => $authn,
;
bless $json_query_servlet, $class;
return $json_query_servlet;
}
#}}}
#{{{sub set_results
sub set_results {
my ( $json_query_servlet, $message, $response ) = @_;
$json_query_servle
s;
}
#}}}
#{{{sub get_acl
=pod
=head2 get_acl
Return the access control list for the node in JSON format
=cut
sub get_acl {
my ( $content, $remoteDest ) = @_;
my $res = Apache::Sling::R
read and write privileges to the g-testgroup principal, log the results, including the resulting JSON, to authz.log:
perl $0 -U http://localhost:8080 -r /testdata -P g-testgroup --read --write -u ad
se_url/$remote_dest.json";
}
#}}}
#{{{sub exists_eval
sub exists_eval {
my ($res) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
#{{{sub full_json_setup
sub full_json_setup {
my ( $
'No position or ID to retrieve full json for specified!';
}
return "get $base_url/$remote_dest.infinity.json";
}
#}}}
#{{{sub full_json_eval
sub full_json_eval {
my ($res) = @_;
ret
alse.
=head2 full_json_setup
Returns a textual representation of the request needed to retrieve the full JSON
representation of a piece of content in the system.
=head2 full_json_eval
Inspects the
#!/usr/bin/perl -w
package Apache::Sling::JsonQueryServletUtil;
use 5.008001;
use strict;
use warnings;
use Carp;
use Apache::Sling::URL;
require Exporter;
use base qw(Exporter);
our @EXPORT_OK =
( !defined $base_url ) { croak 'No base url defined!'; }
return "get $base_url/content.query.json?queryType=xpath&statement=//*";
}
#}}}
#{{{sub all_nodes_eval
sub all_nodes_eval {
my ($re
s) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
1;
__END__
=head1 NAME
Apache::Sling::JsonQueryServletUtil - Methods to generate and check HTTP requests required for querying.
=head1 ABST