|
From: Chris W. <la...@us...> - 2001-11-20 04:05:43
|
Update of /cvsroot/openinteract/OpenInteract/pkg/base_security/OpenInteract/Handler
In directory usw-pr-cvs1:/tmp/cvs-serv25543/base_security/OpenInteract/Handler
Modified Files:
Security.pm
Log Message:
update security templates (concise in display and specification) and
modify slightly the handler to deal with either object or handler
class
Index: Security.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/pkg/base_security/OpenInteract/Handler/Security.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Security.pm 2001/09/28 18:59:52 1.11
--- Security.pm 2001/11/20 04:05:40 1.12
***************
*** 18,22 ****
use constant MAIN_SCRIPT => '/Security';
- use constant OI_PACKAGE => 'base_security';
my $SECURE_CLASS = 'SPOPS::Secure';
--- 18,21 ----
***************
*** 58,65 ****
$classes_visited{ $action_class }++;
}
return $R->template->handler( {}, { object_list => \@object_class,
action_list => \@action_class },
! { db => 'object_class_list',
! package => OI_PACKAGE } );
}
--- 57,64 ----
$classes_visited{ $action_class }++;
}
+ $R->{page}{title} = 'Security Listing';
return $R->template->handler( {}, { object_list => \@object_class,
action_list => \@action_class },
! { name => 'base_security::object_class_list' });
}
***************
*** 131,136 ****
$R->{page}->{title} = 'Edit Object Security';
return $R->template->handler( {}, $params,
! { db => 'assign_object_security',
! package => 'base_security' } );
}
--- 130,134 ----
$R->{page}->{title} = 'Edit Object Security';
return $R->template->handler( {}, $params,
! { name => 'base_security::assign_object_security' } );
}
***************
*** 173,178 ****
$R->{page}->{title} = 'Object Hierarchy Security';
return $R->template->handler( {}, $params,
! { db => 'hierarchy_security',
! package => 'base_security' } );
}
--- 171,175 ----
$R->{page}->{title} = 'Object Hierarchy Security';
return $R->template->handler( {}, $params,
! { name => 'base_security::hierarchy_security' } );
}
***************
*** 208,211 ****
--- 205,209 ----
my ( $total, $success ) = ( 0, 0 );
+ my ( @status_ok );
my $security_object_class = $R->security_object;
foreach my $info ( @scope ) {
***************
*** 219,225 ****
scope_id => $info->[1],
security_level => $level };
! my $method = ( $level eq 'clear' )
? 'remove_item_security' : 'set_item_security';
! $success += eval { $SECURE_CLASS->$method( $security_params ) };
if ( $@ ) {
my $ei = OpenInteract::Error->set( SPOPS::Error->get );
--- 217,223 ----
scope_id => $info->[1],
security_level => $level };
! my $method = ( $level eq 'clear' )
? 'remove_item_security' : 'set_item_security';
! eval { $SECURE_CLASS->$method( $security_params ) };
if ( $@ ) {
my $ei = OpenInteract::Error->set( SPOPS::Error->get );
***************
*** 227,245 ****
$R->throw({ code => 406 });
}
}
my ( $error_msg );
! if ( $total != $success ) {
$error_msg = "Attempted to set ($total); set ($success). Some " .
"attempts had errors.";
}
my $return_url = $apr->param( 'return_url' );
if ( $return_url ) {
my ( $action_class, $action_method ) = $R->lookup_action( 'redirect' );
! return $action_class->$action_method({ url => $return_url,
! error_msg => $error_msg });
}
return $class->show({ object_class => $object_class,
object_id => $object_id,
error_msg => $error_msg });
}
--- 225,250 ----
$R->throw({ code => 406 });
}
+ else {
+ push @status_ok, $object_id;
+ }
}
my ( $error_msg );
! if ( $total != scalar @status_ok ) {
$error_msg = "Attempted to set ($total); set ($success). Some " .
"attempts had errors.";
}
+ my $status_msg = "Security for $object_class set for the following IDs: " .
+ join( ', ', @status_ok );
my $return_url = $apr->param( 'return_url' );
if ( $return_url ) {
my ( $action_class, $action_method ) = $R->lookup_action( 'redirect' );
! return $action_class->$action_method({ url => $return_url,
! error_msg => $error_msg,
! status_msg => $status_msg });
}
return $class->show({ object_class => $object_class,
object_id => $object_id,
+ status_msg => $status_msg,
error_msg => $error_msg });
}
***************
*** 323,327 ****
my $apr = OpenInteract::Request->instance->apache;
$object_class = $p->{object_class} ||
! $apr->param( 'object_class' );
$object_id = $p->{object_id} ||
$apr->param( 'oid' ) ||
--- 328,334 ----
my $apr = OpenInteract::Request->instance->apache;
$object_class = $p->{object_class} ||
! $apr->param( 'object_class' ) ||
! $p->{handler_class} ||
! $apr->param( 'handler_class' );
$object_id = $p->{object_id} ||
$apr->param( 'oid' ) ||
|