Apache-Sling
view release on metacpan or search on metacpan
lib/Apache/Sling/AuthzUtil.pm view on Meta::CPAN
#!/usr/bin/perl
package Apache::Sling::AuthzUtil;
use 5.008001;
use strict;
use warnings;
use Carp;
require Exporter;
use base qw(Exporter);
our @EXPORT_OK = ();
our $VERSION = '0.27';
#{{{imports
use strict;
use lib qw ( .. );
#}}}
#{{{sub get_acl_setup
=pod
=head2 get_acl_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 url defined!" unless defined $base_url;
croak "No destination 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 issuing the request generated in
get_acl_setup returning true if the result indicates the node ACL was returned
successfully, else false.
=cut
sub get_acl_eval {
my ($res) = @_;
return ( $$res->code =~ /^200$/x );
}
#}}}
#{{{sub delete_setup
=pod
=head2 delete_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 "No base url defined!" unless defined $base_url;
croak "No destination to delete ACL for defined!"
unless defined $remote_dest;
croak "No principal to delete ACL for defined!" unless defined $principal;
my $post_variables = "\$post_variables = [':applyTo','$principal']";
( run in 0.484 second using v1.01-cache-2.11-cpan-39bf76dae61 )