Apache-Sling
view release on metacpan or search on metacpan
lib/Apache/Sling/UserUtil.pm view on Meta::CPAN
#}}}
#{{{sub change_password_eval
sub change_password_eval {
my ($res) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
#{{{sub delete_setup
sub delete_setup {
my ( $base_url, $act_on_user ) = @_;
if ( !defined $base_url ) {
croak 'No base url defined to delete against!';
}
if ( !defined $act_on_user ) { croak 'No user name defined to delete!'; }
my $post_variables = '$post_variables = []';
return
"post $base_url/system/userManager/user/$act_on_user.delete.html $post_variables";
}
#}}}
#{{{sub delete_eval
sub delete_eval {
my ($res) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
#{{{sub exists_setup
sub exists_setup {
my ( $base_url, $act_on_user ) = @_;
if ( !defined $base_url ) {
croak 'No base url to check existence against!';
}
if ( !defined $act_on_user ) {
croak 'No user to check 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 eq '200' );
}
#}}}
#{{{sub update_setup
sub update_setup {
my ( $base_url, $act_on_user, $properties ) = @_;
if ( !defined $base_url ) {
croak 'No base url defined to update against!';
}
if ( !defined $act_on_user ) { croak 'No user name defined to update!'; }
my $property_post_vars =
Apache::Sling::URL::properties_array_to_string($properties);
my $post_variables = '$post_variables = [';
if ( $property_post_vars ne q{} ) {
$post_variables .= "$property_post_vars";
}
$post_variables .= ']';
return
"post $base_url/system/userManager/user/$act_on_user.update.html $post_variables";
}
#}}}
#{{{sub update_eval
sub update_eval {
my ($res) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
1;
__END__
=head1 NAME
Apache::Sling::UserUtil - Methods to generate and check HTTP requests required for manipulating users.
=head1 ABSTRACT
Utility library returning strings representing Rest queries that perform
user related actions in the system.
=head1 METHODS
=head2 add_setup
Returns a textual representation of the request needed to add the user to the
system.
=head2 add_eval
Check result of adding user to the system.
=head2 change_password_setup
Returns a textual representation of the request needed to change the password
of the user in the system.
=head2 change_password_eval
Verify whether the change password attempt for the user in the system was successful.
=head2 delete_setup
Returns a textual representation of the request needed to delete the user from
the system.
=head2 delete_eval
Check result of deleting user from the system.
=head2 exists_setup
Returns a textual representation of the request needed to test whether a given
username exists in the system.
=head2 exists_eval
Inspects the result returned from issuing the request generated in exists_setup
returning true if the result indicates the username does exist in the system,
else false.
=head2 update_setup
( run in 0.965 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )