OpenInteract2/Exception/Security.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 50.0% 5 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 78.8% 41 / 52 CC 7 SCAR 18.1
CC
7
Cov
79%
full_message
9.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.1
« OpenInteract2/Manage/Package.pm ↑ Summary OpenInteract2/ParamContainer.pm »
1 package OpenInteract2::Exception::Security;
2  
3 # $Id: Security.pm,v 1.13 2005/03/17 14:58:02 sjn Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( OpenInteract2::Exception Class::Accessor::Fast );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use SPOPS::Secure qw( :verbose :level );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 87 $OpenInteract2::Exception::Security::VERSION = sprintf("%d.%02d", q$Revision: 1.13 $ =~ /(\d+)\.(\d+)/);
10  
11 87 my @FIELDS = qw( security_required security_found );
12 87 OpenInteract2::Exception::Security->mk_accessors( @FIELDS );
13 2 ▶sub Fields { return @FIELDS }
Subroutine Fields: called CC=1 SCAR=0.0
Pod documented
14  
15 87 my ( $CTX );
16  
17 87 my $DEFAULT_MSG = "Security violation. Object requires '%s' but got '%s'";
18  
19 87 my %LEVELS = (
20 SEC_LEVEL_NONE() => SEC_LEVEL_NONE_VERBOSE,
21 SEC_LEVEL_SUMMARY() => SEC_LEVEL_SUMMARY_VERBOSE,
22 SEC_LEVEL_READ() => SEC_LEVEL_READ_VERBOSE,
23 SEC_LEVEL_WRITE() => SEC_LEVEL_WRITE_VERBOSE,
24 );
25  
26 2 ▶sub full_message {
Subroutine full_message: called CC=7 SCAR=22.0
Pod documented
27 2 my ( $self ) = @_;
28 my $required = ( $self->security_required )
29 2 ▶ ? $LEVELS{ $self->security_required }
Branch: 1 branch
BranchTrueFalseTotal
$self->security_required ? : 2 0 2
30 : 'none specified';
31 my $found = ( $self->security_found )
32 2 ▶ ? $LEVELS{ $self->security_found }
Branch: 1 branch
BranchTrueFalseTotal
$self->security_found ? : 2 0 2
33 : 'none specified';
34 2 ▶ unless ( $CTX ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CTX) 2 0 2
35 2 require OpenInteract2::Context;
36 2 $CTX = OpenInteract2::Context->instance( 1 );
37 }
38 2 my ( $msg );
39 2 ▶ if ( $CTX && $CTX->request ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CTX and $CTX->request) 0 2 2
Condition33%1/3
$CTX and $CTX->request
!ll&&!rl&&r
200
MC/DC0%0/2
$CTX and $CTX->request
$CTX $CTX->request
Truth table33%1/3
A and B
A= $CTXB= $CTX->request
ABresult
0X0
100
111
40 0 $msg = eval {
41 0 $CTX->request
42 ->language_handle
43 ->maketext( 'global.exception.security', $required, $found );
44 };
45 }
46 2 ▶ unless ( $msg ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($msg) 2 0 2
47 2 $msg = sprintf( $DEFAULT_MSG, $required, $found );
48 }
49 2 return $msg;
50 }
51  
52 87 1;
53  
54 __END__
« OpenInteract2/Manage/Package.pm ↑ Summary OpenInteract2/ParamContainer.pm »