blib/lib/Lemonldap/NG/Portal/Auth/Choice.pm

filter: Statementstmt 92.3% 48 / 52 Branchbran 70.0% 14 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 7 totaltotal 73.7% 73 / 99 CC 14 SCAR 16.8
CC
14
Cov
79%
isCallback
16.2
extractFormInfo
4.0
setAuthSessionInfo
3.1
CRAP 5.3
« blib/lib/Lemonldap/NG/Portal/Lib/LazyLoadedConfiguration.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Captcha/CaptchEtat.pm »
1 package Lemonldap::NG::Portal::Auth::Choice;
2  
3 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 28 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 28 ▶use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS PE_ERROR);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 27 our $VERSION = '2.21.0';
8  
9 27 extends 'Lemonldap::NG::Portal::Lib::Choice';
10  
11 # INITIALIZATION
12  
13 58 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
14 58 return $_[0]->SUPER::init(0);
15 }
16  
17 # RUNNING METHODS
18  
19 1 ▶sub _authCancel {
Subroutine _authCancel: called CC=1 SCAR=0.0
20 1 my ( $self, $req ) = @_;
21 1 delete $req->pdata->{_choice};
22 1 return $self->SUPER::_authCancel($req);
23 }
24  
25 48 ▶sub extractFormInfo {
Subroutine extractFormInfo: called CC=4 SCAR=13.9
Pod undocumented
26 48 my ( $self, $req ) = @_;
27  
28 $self->logger->debug( "Send init/script -> " . $req->data->{customScript} )
29 48 ▶ if $req->data->{customScript};
Branch: 1 branch
BranchTrueFalseTotal
if $req->data->{"customScript"} 0 48 48
30 48 ▶ unless ( $self->checkChoice($req) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->checkChoice($req)) 10 38 48
31 10 $self->setSecurity($req);
32 10 return PE_FIRSTACCESS;
33 }
34  
35 38 my $res = $req->data->{enabledMods0}->[0]->extractFormInfo($req);
36 38 ▶ if ( $res > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res > 0) 8 30 38
37 8 $self->setSecurity($req);
38 8 delete $req->pdata->{_choice};
39 }
40 38 return $res;
41 }
42  
43 17 ▶sub authenticate {
Subroutine authenticate: called CC=2 SCAR=6.9
Pod undocumented
44 17 my $res = $_[1]->data->{enabledMods0}->[0]->authenticate( $_[1] );
45 17 ▶ delete $_[1]->pdata->{_choice} if ( $res > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $res > 0 1 16 17
46 17 return $res;
47 }
48  
49 15 ▶sub setAuthSessionInfo {
Subroutine setAuthSessionInfo: called CC=3 SCAR=11.3
Pod undocumented
50 15 my ( $self, $req ) = @_;
51 15 ▶ $self->checkChoice($req) unless ( $req->data->{enabledMods0} );
Branch: 1 branch
BranchTrueFalseTotal
unless $req->data->{"enabledMods0"} 0 15 15
52 15 my $res = $req->data->{enabledMods0}->[0]->setAuthSessionInfo($req);
53 15 ▶ delete $_[1]->pdata->{_choice} if ( $res > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $res > 0 0 15 15
54 15 return $res;
55 }
56  
57 9 ▶sub authLogout {
Subroutine authLogout: called CC=2 SCAR=6.9
Pod undocumented
58 9 ▶ $_[0]->checkChoice( $_[1] ) or return PE_OK;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->checkChoice($_[1]) or return 0 8 1 9
59 8 my $res = $_[1]->data->{enabledMods0}->[0]->authLogout( $_[1] );
60 8 delete $_[1]->pdata->{_choice};
61 8 delete $_[1]->data->{_authChoice};
62 8 return $res;
63 }
64  
65 25 ▶sub setSecurity {
Subroutine setSecurity: called CC=3 SCAR=11.0
Pod undocumented
66 25 my ( $self, $req ) = @_;
67 25 foreach my $mod ( values %{ $self->modules } ) {
68 36 ▶ if ( $mod->can('setSecurity') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mod->can("setSecurity")) 18 18 36
69 18 $mod->setSecurity($req);
70 18 last;
71 }
72 }
73 }
74  
75 3 ▶sub isCallback {
Subroutine isCallback: called CC=5 SCAR=27.8
Pod undocumented
76 3 my ( $self, $req ) = @_;
77 3 ▶ if ( my $choice = $req->pdata->{_choice} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $choice = $req->pdata->{"_choice"}) 0 3 3
78 0 my $mod = $self->modules->{$choice};
79 0 ▶ if ( $mod and $mod->can('isCallback') and $mod->isCallback($req) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mod and $mod->can("isCallback") and $mod->isCallback($req)) 0 0 0
Condition0%0/6
$mod and $mod->can("isCallback") and $mod->isCallback($req)
!ll&&!rl&&r
000
$mod and $mod->can("isCallback")
!ll&&!rl&&r
000
MC/DC0%0/3
$mod and $mod->can("isCallback") and $mod->isCallback($req)
$mod $mod->can("isCallback") $mod->isCallback($req)
Truth table0%0/4
A and B and C
A= $modB= $mod->can("isCallback")C= $mod->isCallback($req)
ABCresult
0XX0
10X0
1100
1111
80 0 $self->logger->debug("Detected callback for $choice");
81 0 return 1;
82 }
83 }
84 3 return;
85 }
86  
87 27 1;
« blib/lib/Lemonldap/NG/Portal/Lib/LazyLoadedConfiguration.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Captcha/CaptchEtat.pm »