NAME
OpenInteract2::CreateSecurity - Batch create security for one or more objects or classes
SYNOPSIS
# 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";
DESCRIPTION
This class can create or update security for a single action class or for a whole group of SPOPS objects.
CLASS METHODS
new( \%properties )
Create a new object and assign all properties from \%properties
. See PROPERTIES
for listing.
OBJECT METHODS
run()
With the PROPERTIES
previously set find matching security objects; if found, update them with the new security level, otherwise create new objects.
PROPERTIES
scope
website_dir
scope_id
level
action
action_class (assigned after validate()
)
spops
spops_class (assigned after validate()
)
where
iterator
num_processed
num_failed
start_time
end_time
elapsed_time
SEE ALSO
OpenInteract2::Manage::Website::CreateSecurityForAction
OpenInteract2::Manage::Website::CreateSecurityForSPOPS
COPYRIGHT
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.
AUTHORS
Chris Winters <chris@cwinters.com>