From: Chris W. <la...@us...> - 2005-03-04 02:51:58
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/Config Modified Files: Initializer.pm Log Message: allow 'security' to be assigned for all tasks at once Index: Initializer.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Config/Initializer.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Initializer.pm 30 Nov 2004 03:12:11 -0000 1.20 --- Initializer.pm 4 Mar 2005 02:51:45 -0000 1.21 *************** *** 347,364 **** my ( $init, $type, $config ) = @_; return unless ( $type eq 'action' ); ! return unless ( ref $config->{security} eq 'HASH' ); $log ||= get_logger( LOG_INIT ); $log->info( "Modifying verbose security for action '$config->{name}'" ); ! foreach my $task ( keys %{ $config->{security} } ) { ! my $task_security = uc $config->{security}{ $task }; ! if ( $task_security =~ /^(NONE|SUMMARY|READ|WRITE)$/i ) { ! $task_security = ! OpenInteract2::Util->verbose_to_level( uc $task_security ); } ! $config->{security}{ $task } = int( $task_security ); } } sub _action_cache_params { --- 347,374 ---- my ( $init, $type, $config ) = @_; return unless ( $type eq 'action' ); ! return unless ( $config->{security} ); $log ||= get_logger( LOG_INIT ); $log->info( "Modifying verbose security for action '$config->{name}'" ); ! ! if ( ref $config->{security} eq 'HASH' ) { ! foreach my $task ( keys %{ $config->{security} } ) { ! my $verbose = uc $config->{security}{ $task }; ! $config->{security}{ $task } = _translate_security_to_level( $verbose ); } ! } ! else { ! my $verbose = uc $config->{security}; ! $config->{security} = _translate_security_to_level( $verbose ); } } + sub _translate_security_to_level { + my ( $verbose ) = @_; + if ( $verbose =~ /^(NONE|SUMMARY|READ|WRITE)$/i ) { + $verbose = OpenInteract2::Util->verbose_to_level( uc $task_security ); + } + return int( $verbose ); + } sub _action_cache_params { *************** *** 668,672 **** In the action configuration you can use verbose descriptions of security levels like 'READ' and 'WRITE'. These get translated to the ! codes exported by L<SPOPS::Secure|SPOPS::Secure>. =item B<Caching Parameters> --- 678,683 ---- In the action configuration you can use verbose descriptions of security levels like 'READ' and 'WRITE'. These get translated to the ! codes exported by L<SPOPS::Secure|SPOPS::Secure> via the ! C<verbose_to_level()> method in L<OpenInteract2::Util>. =item B<Caching Parameters> |