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

filter: Statementstmt 76.9% 40 / 52 Branchbran 50.0% 10 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 7 totaltotal 59.6% 59 / 99 CC 14 SCAR 21.5
CC
14
Cov
64%
isCallback
30.0
authLogout
6.0
extractFormInfo
4.0
CRAP 8.6
« blib/lib/Lemonldap/NG/Portal/2F/Ext2F.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Register/LDAP.pm »
1 package Lemonldap::NG::Portal::Auth::Choice;
2  
3 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 26 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS PE_ERROR);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 25 our $VERSION = '2.21.0';
8  
9 25 extends 'Lemonldap::NG::Portal::Lib::Choice';
10  
11 # INITIALIZATION
12  
13 sub init {
14 32 ▶ return $_[0]->SUPER::init(0);
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
15 }
16  
17 # RUNNING METHODS
18  
19 sub _authCancel {
20 1 ▶ my ( $self, $req ) = @_;
Subroutine _authCancel: called CC=1 SCAR=0.0
21 1 delete $req->pdata->{_choice};
22 1 return $self->SUPER::_authCancel($req);
23 }
24  
25 sub extractFormInfo {
26 20 ▶ my ( $self, $req ) = @_;
Subroutine extractFormInfo: called CC=4 SCAR=13.9
Pod undocumented
27  
28 $self->logger->debug( "Send init/script -> " . $req->data->{customScript} )
29 20 ▶ if $req->data->{customScript};
Branch: 1 branch
BranchTrueFalseTotal
if $req->data->{"customScript"} 0 20 20
30 20 ▶ unless ( $self->checkChoice($req) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->checkChoice($req)) 3 17 20
31 3 $self->setSecurity($req);
32 3 return PE_FIRSTACCESS;
33 }
34  
35 17 my $res = $req->data->{enabledMods0}->[0]->extractFormInfo($req);
36 17 ▶ if ( $res > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res > 0) 6 11 17
37 6 $self->setSecurity($req);
38 6 delete $req->pdata->{_choice};
39 }
40 17 return $res;
41 }
42  
43 sub authenticate {
44 4 ▶ my $res = $_[1]->data->{enabledMods0}->[0]->authenticate( $_[1] );
Subroutine authenticate: called CC=2 SCAR=7.1
Pod undocumented
45 4 ▶ delete $_[1]->pdata->{_choice} if ( $res > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $res > 0 0 4 4
46 4 return $res;
47 }
48  
49 sub setAuthSessionInfo {
50 4 ▶ my ( $self, $req ) = @_;
Subroutine setAuthSessionInfo: called CC=3 SCAR=11.3
Pod undocumented
51 4 ▶ $self->checkChoice($req) unless ( $req->data->{enabledMods0} );
Branch: 1 branch
BranchTrueFalseTotal
unless $req->data->{"enabledMods0"} 0 4 4
52 4 my $res = $req->data->{enabledMods0}->[0]->setAuthSessionInfo($req);
53 4 ▶ delete $_[1]->pdata->{_choice} if ( $res > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $res > 0 0 4 4
54 4 return $res;
55 }
56  
57 sub authLogout {
58 0 ▶ $_[0]->checkChoice( $_[1] ) or return PE_OK;
Subroutine authLogout: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->checkChoice($_[1]) or return 0 0 0 0
59 0 my $res = $_[1]->data->{enabledMods0}->[0]->authLogout( $_[1] );
60 0 delete $_[1]->pdata->{_choice};
61 0 delete $_[1]->data->{_authChoice};
62 0 return $res;
63 }
64  
65 sub setSecurity {
66 10 ▶ my ( $self, $req ) = @_;
Subroutine setSecurity: called CC=3 SCAR=11.0
Pod undocumented
67 10 foreach my $mod ( values %{ $self->modules } ) {
68 12 ▶ if ( $mod->can('setSecurity') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mod->can("setSecurity")) 3 9 12
69 3 $mod->setSecurity($req);
70 3 last;
71 }
72 }
73 }
74  
75 sub isCallback {
76 0 ▶ my ( $self, $req ) = @_;
Subroutine isCallback: not called CC=5 SCAR=34.0
Pod undocumented
77 0 ▶ if ( my $choice = $req->pdata->{_choice} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $choice = $req->pdata->{"_choice"}) 0 0 0
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 0 return;
85 }
86  
87 25 1;
« blib/lib/Lemonldap/NG/Portal/2F/Ext2F.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Register/LDAP.pm »