OpenInteract2::CreateSecurity - Batch create security for one or more objects or classes
# Create security for an action my $creator = OpenInteract2::CreateSecurity->new({ scope => 'group', scope_id => '5', level => 'write' action => 'myaction', website_dir => '/path/to/mysite', }); unless ( $creator->validate ) { my $errors = $creator->errors_with_params; print "Found errors: \n"; foreach my $param ( keys %{ $errors } ) { print "$param: $errors->{ $param }\n"; } # can also pass the error hashref to the standard exception for # bad parameters: OpenInteract2::Exception::Parameter->throw( "Cannot create security, one or more parameters were invalid", { parameter_fail => $errors } ); } # we're cleared for takeoff $creator->run(); # how'd we do? print "Processed: ", $creator->num_processed, "\n", "Failed: ", $creator->num_failed, "\n", "Elapsed: ", $creator->elapsed_time, " secs\n";
This class can create or update security for a single action class or for a whole group of SPOPS objects.
new( \%properties )
Create a new object and assign all properties from \%properties. See PROPERTIES for listing.
\%properties
PROPERTIES
run()
With the PROPERTIES previously set find matching security objects; if found, update them with the new security level, otherwise create new objects.
scope
website_dir
scope_id
level
action
action_class (assigned after validate())
validate()
spops
spops_class (assigned after validate())
where
iterator
num_processed
num_failed
start_time
end_time
elapsed_time
OpenInteract2::Manage::Website::CreateSecurityForAction
OpenInteract2::Manage::Website::CreateSecurityForSPOPS
Copyright (c) 2005 Chris Winters. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Chris Winters <chris@cwinters.com>
To install OpenInteract2::URL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenInteract2::URL
CPAN shell
perl -MCPAN -e shell install OpenInteract2::URL
For more information on module installation, please visit the detailed CPAN module installation guide.