Apache-Sling
view release on metacpan or search on metacpan
lib/Apache/Sling/Group.pm view on Meta::CPAN
my $exists;
my @property;
my $view;
my %group_config = (
'auth' => \$sling->{'Auth'},
'help' => \$sling->{'Help'},
'log' => \$sling->{'Log'},
'man' => \$sling->{'Man'},
'pass' => \$sling->{'Pass'},
'threads' => \$sling->{'Threads'},
'url' => \$sling->{'URL'},
'user' => \$sling->{'User'},
'verbose' => \$sling->{'Verbose'},
'add' => \$add,
'additions' => \$additions,
'delete' => \$delete,
'exists' => \$exists,
'property' => \@property,
'view' => \$view
);
return \%group_config;
}
#}}}
#{{{sub del
sub del {
my ( $group, $act_on_group ) = @_;
my $res = Apache::Sling::Request::request(
\$group,
Apache::Sling::GroupUtil::delete_setup(
$group->{'BaseURL'}, $act_on_group
)
);
my $success = Apache::Sling::GroupUtil::delete_eval($res);
my $message = "Group: \"$act_on_group\" ";
$message .= ( $success ? 'deleted!' : 'was not deleted!' );
$group->set_results( "$message", $res );
return $success;
}
#}}}
#{{{ sub help
sub help {
print <<"EOF";
Usage: perl $0 [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]
The following options are accepted:
--additions or -A (file) - file containing list of groups to be added.
--add or -a (actOnGroup) - add specified group.
--auth (type) - Specify auth type. If ommitted, default is used.
--delete or -d (actOnGroup) - delete specified group.
--exists or -e (actOnGroup) - check whether specified group exists.
--help or -? - view the script synopsis and options.
--log or -L (log) - Log script output to specified log file.
--man or -M - view the full script documentation.
--pass or -p (password) - Password of user performing actions.
--property or -P (property=value) - Specify property to set on group.
--threads or -t (threads) - Used with -A, defines number of parallel
processes to have running through file.
--url or -U (URL) - URL for system being tested against.
--user or -u (username) - Name of user to perform any actions as.
--verbose or -v or -vv or -vvv - Increase 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 between options and their arguments.
For full details run: perl $0 --man
EOF
return 1;
}
#}}}
#{{{ sub man
sub man {
my ($group) = @_;
print <<'EOF';
group perl script. Provides a means of managing groups in sling from the
command line. The script also acts as a reference implementation for the Group
perl library.
EOF
$group->help();
print <<"EOF";
Example Usage
* Authenticate and add a group with id g-test:
perl group.pl -U http://localhost:8080 -u admin -p admin -a g-test
* Authenticate and check whether group with id g-test exists:
perl group.pl -U http://localhost:8080 -u admin -p admin -a g-test
* Authenticate and view details for group with id g-test:
perl group.pl -U http://localhost:8080 -u admin -p admin -V g-test
* Authenticate and delete group with id g-test:
perl group.pl -U http://localhost:8080 -u admin -p admin -d g-test
* Authenticate and add a group with id g-test and property p1=v1:
perl group.pl -U http://localhost:8080 -u admin -p admin -a g-test -P p1=v1
EOF
return 1;
}
( run in 0.622 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )