« blib/lib/Lemonldap/NG/Portal/Lib/REST.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Plugins/TrustedBrowser.pm »
| 1 | ##@file | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # menu for lemonldap::ng portal | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Lemonldap::NG::Portal::Main::Menu; | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 454 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 454 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 454 | ▶ | use Clone 'clone'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 454 | ▶ | use Lemonldap::NG::Portal::Main::Constants 'URIRE'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 454 | our $VERSION = '2.23.0'; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 454 | extends 'Lemonldap::NG::Portal::Main::Plugin'; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # PROPERTIES | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | has menuModules => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 8 | ▶ | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 8 | my $conf = $_[0]->{conf}; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | my (@res); | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | my @modules = $_[0]->_get_display_order( $conf->{portalDisplayOrder} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | 8 | foreach (@modules) { | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 40 | ▶ | my $cond = $conf->{"portalDisplay$_"} // 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$conf{"portalDisplay$_"} // 1
MC/DC0%0/1
$$conf{"portalDisplay$_"} // 1
$$conf{"portalDisplay$_"}
Truth table50%1/2
A
A= $$conf{"portalDisplay$_"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 40 | $_[0]->p->logger->debug("Evaluate condition $cond for module $_"); | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 40 | my $tmp = | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | $_[0] | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ->p->HANDLER->buildSub( $_[0]->p->HANDLER->substitute($cond) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 40 | ▶ | push @res, [ $_, $tmp ] if $tmp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | return \@res; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 454 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 671 | ▶ | has specific => ( is => 'rw', default => sub { {} } ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 671 | ▶ | has sfManagerRule => ( is => 'rw', default => sub { 1 } ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | has imgPath => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | return $_[0]->conf->{impgPath} | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | || $_[0]->conf->{staticPrefix} . '/logos'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$_[0]->conf->{'impgPath'} || $_[0]->conf->{'staticPrefix'} . '/logos'
MC/DC0%0/1
$_[0]->conf->{'impgPath'} || $_[0]->conf->{'staticPrefix'} . '/logos'
$_[0]->conf->{'impgPath'}
Truth table0%0/2
A
A= $_[0]->conf->{'impgPath'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 454 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # INITIALIZATION | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 671 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 671 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | $self->sfManagerRule( | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 671 | $self->p->buildRule( $self->conf->{sfManagerRule}, 'sfManagerRule' ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 671 | ▶ | $self->sfManagerRule(1) unless $self->sfManagerRule; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Allow custom plugins to register new menu tabs | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 671 | $self->addEntryPoint( | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | does => "Lemonldap::NG::Portal::MenuTab", | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | service => "menu", | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | method => "_register_tab", | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 671 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # RUNNING METHODS | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # Prepare menu template elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # Returns hash (=list) containing : | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # - DISPLAY_MODULES | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # - AUTH_ERROR | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # - AUTH_ERROR_TYPE | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 12 | ▶ | sub params { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
params: called CC=14 SCAR=28.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 12 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | 12 | ▶ | $self->conf->{imgPath} ||= $self->{staticPrefix}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->conf->{"imgPath"} ||= $self->{"staticPrefix"}
MC/DC0%0/2
$self->conf->{"imgPath"} ||= $self->{"staticPrefix"}
$self->conf->{"imgPath"}
$self->{"staticPrefix"}
Truth table33%1/3
A ||= B
A= $self->conf->{"imgPath"}B= $self->{"staticPrefix"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 12 | my %res; | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 12 | my @defaultTabs = (qw/appslist password logout loginHistory oidcConsents/); | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 12 | ▶ | my @customTabs = split /[,\s]+/, $self->conf->{customMenuTabs} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->conf->{'customMenuTabs'} || ''
MC/DC0%0/1
$self->conf->{'customMenuTabs'} || ''
$self->conf->{'customMenuTabs'}
Truth table50%1/2
A
A= $self->conf->{'customMenuTabs'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Modules to display | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 12 | $res{DISPLAY_MODULES} = $self->displayModules($req); | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Display noApp message | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | $res{NO_APP_ALLOWED} = $req->data->{noApp}; | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | $res{AUTH_ERROR_TYPE} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 12 | $req->error_type( $res{AUTH_ERROR} = $req->menuError ); | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | 12 | $res{AUTH_ERROR_ROLE} = $req->error_role; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | 12 | ▶ | $res{ 'AUTH_ERROR_' . $res{AUTH_ERROR} } = 1 if $res{AUTH_ERROR}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # Display menu 2fRegisters link only if at least a 2F device is registered and rule | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | $res{sfaManager} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 12 | ▶ | $self->p->_sfEngine->display2fRegisters( $req, $req->userData ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->p->_sfEngine->display2fRegisters($req, $req->userData) && $self->sfManagerRule->($req, $req->userData)
MC/DC0%0/2
$self->p->_sfEngine->display2fRegisters($req, $req->userData) && $self->sfManagerRule->($req, $req->userData)
$self->p->_sfEngine->display2fRegisters($req, $req->userData)
$self->sfManagerRule->($req, $req->userData)
Truth table33%1/3
A && B
A= $self->p->_sfEngine->display2fRegisters($req, $req->userData)B= $self->sfManagerRule->($req, $req->userData)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | && $self->sfManagerRule->( $req, $req->userData ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 12 | ▶ | $self->logger->debug('Display 2fRegisters link') if $res{sfaManager}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # Display refresh my rights unless disabled | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 12 | $res{RefreshMyRights} = $self->conf->{portalDisplayRefreshMyRights}; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | $self->logger->debug('Display RefreshMyRights link') | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 12 | ▶ | if $res{RefreshMyRights}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Display menu links only if required | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 12 | foreach (qw(ContextSwitching DecryptValue Notifications)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | my $plugin = | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 36 | $self->p->loadedModules->{"Lemonldap::NG::Portal::Plugins::$_"}; | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | 36 | ▶ | $res{$_} = | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | $plugin | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ? $plugin->displayLink( $req, $req->userData ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | : ''; | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 36 | my $msg = "Display $_ link"; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | $msg .= " -> $res{ContextSwitching}" | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 36 | ▶ | if ( $_ eq 'ContextSwitching' && $res{$_} ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_ eq "ContextSwitching" and $res{$_}
MC/DC0%0/2
$_ eq "ContextSwitching" and $res{$_}
$_ eq "ContextSwitching"
$res{$_}
Truth table66%2/3
A and B
A= $_ eq "ContextSwitching"B= $res{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 36 | ▶ | $self->logger->debug($msg) if $res{$_}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 36 | undef $plugin; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # Decide whether to display the dropdown or regular text | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | $res{DropdownMenu} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | 12 | foreach ( | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | qw(RefreshMyRights sfaManager Notifications DecryptValue ContextSwitching) | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 12 | ▶ | if ( $res{$_} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 12 | $res{DropdownMenu} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 12 | return %res; | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ## @method arrayref displayModules() | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # List modules that can be displayed in Menu | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # @return modules list | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 12 | ▶ | sub displayModules { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
displayModules: called CC=9 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 12 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 12 | my $displayModules = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # Foreach module, eval condition | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Store module in result if condition is valid | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 12 | foreach my $module ( @{ $self->menuModules } ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 60 | $self->logger->debug("Check if $module->[0] has to be displayed"); | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 60 | ▶ | if ( $module->[1]->( $req, $req->userData ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 45 | my $moduleHash = { $module->[0] => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | 45 | ▶ | if ( $module->[0] eq 'Appslist' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 12 | $moduleHash->{'APPSLIST_LOOP'} = $self->appslist($req); | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | $req->data->{noApp} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 12 | ▶ | unless scalar @{ $moduleHash->{'APPSLIST_LOOP'} }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | elsif ( $module->[0] eq 'LoginHistory' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | $moduleHash->{'SUCCESS_LOGIN'} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $self->p->mkSessionArray( $req, | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | $req->userData->{_loginHistory}->{successLogin}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 12 | "", 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | $moduleHash->{'FAILED_LOGIN'} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | $self->p->mkSessionArray( $req, | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | $req->userData->{_loginHistory}->{failedLogin}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 12 | "", 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | elsif ( $module->[0] eq 'OidcConsents' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $moduleHash->{'OIDC_CONSENTS'} = | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | $self->p->mkOidcConsent( $req, $req->userData ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | elsif ( $module->[0] eq 'ChangePassword' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 9 | $moduleHash->{'PPOLICY_RULES'} = $self->p->getPpolicyRules; | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # If the current entry is a plugin | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 45 | ▶ | if ( $module->[2] ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $plugin_hash = $module->[2]->display($req); | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $moduleHash->{_PLUGIN} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $moduleHash->{_PLUGIN_LOGO} = $plugin_hash->{logo}; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $moduleHash->{_PLUGIN_NAME} = $plugin_hash->{name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $moduleHash->{_PLUGIN_ID} = $plugin_hash->{name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $moduleHash->{_PLUGIN_HTML} = $plugin_hash->{html}; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 45 | push @$displayModules, $moduleHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 12 | return $displayModules; | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ## @method arrayref appslist() | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Returns categories and applications list as HTML::Template loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # @return categories and applications list | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 12 | ▶ | sub appslist { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
appslist: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 12 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | 12 | my $appslist = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 12 | ▶ | return $appslist unless defined $self->conf->{applicationList}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # Reset level | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 12 | my $catlevel = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 12 | my $applicationList = clone( $self->conf->{applicationList} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | 12 | my $filteredList = $self->_filter( $req, $applicationList ); | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | 12 | push @$appslist, | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | $self->_buildCategoryHash( $req, "", $filteredList, $catlevel ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # We must return an ARRAY ref | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | return ( ref $appslist->[0]->{categories} eq "ARRAY" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ? $appslist->[0]->{categories} | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 12 | ▶ | : []; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ## @method private hashref _buildCategoryHash(string catname,hashref cathash, int catlevel) | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Build hash for a category | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # @param catname Category name | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # @param cathash Hash of category elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # @param catlevel Category level | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # @return Category Hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 24 | ▶ | sub _buildCategoryHash { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_buildCategoryHash: called CC=17 SCAR=29.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 24 | my ( $self, $req, $catid, $cathash, $catlevel ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | 24 | ▶ | my $catname = $cathash->{catname} || $catid; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cathash->{'catname'} || $catid
MC/DC50%1/2
$cathash->{'catname'} || $catid
$cathash->{'catname'}
$catid
Truth table66%2/3
A || B
A= $cathash->{'catname'}B= $catid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 24 | my $applications; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | my $categories; | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # Extract applications from hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 24 | my $apphash; | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | 24 | foreach my $catkey ( sort keys %$cathash ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | 76 | ▶ | next if $catkey =~ /(type|options|catname|order)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 28 | ▶ | if ( $cathash->{$catkey}->{type} eq "application" ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 16 | $apphash->{$catkey} = $cathash->{$catkey}; | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Display applications first | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 24 | ▶ | if ( scalar keys %$apphash > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 12 | foreach my $appkey ( | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | sort { | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ( $apphash->{$a}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 4 | ▶ | <=> ( $apphash->{$b}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition42%3/7
($apphash->{$a}{'order'} || 0) <=> ($apphash->{$b}{'order'} || 0) || $a cmp $b
$apphash->{$a}{'order'} || 0
$apphash->{$b}{'order'} || 0
MC/DC0%0/2
($apphash->{$a}{'order'} || 0) <=> ($apphash->{$b}{'order'} || 0) || $a cmp $b
$apphash->{$a}{'order'}
$a cmp $b
MC/DC0%0/1
$apphash->{$b}{'order'} || 0
$apphash->{$b}{'order'}
Truth table33%1/3
A || B
A= $apphash->{$a}{'order'}B= $a cmp $b
Truth table50%1/2
A
A= $apphash->{$b}{'order'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | or $a cmp $b | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | keys %$apphash | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | push @$applications, | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 16 | $self->_buildApplicationHash( $appkey, $apphash->{$appkey} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # Display subcategories | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 24 | foreach my $catkey ( | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | sort { | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ( $cathash->{$a}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 4 | ▶ | <=> ( $cathash->{$b}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition42%3/7
($cathash->{$a}{'order'} || 0) <=> ($cathash->{$b}{'order'} || 0) || $a cmp $b
$cathash->{$a}{'order'} || 0
$cathash->{$b}{'order'} || 0
MC/DC0%0/2
($cathash->{$a}{'order'} || 0) <=> ($cathash->{$b}{'order'} || 0) || $a cmp $b
$cathash->{$a}{'order'}
$a cmp $b
MC/DC0%0/1
$cathash->{$b}{'order'} || 0
$cathash->{$b}{'order'}
Truth table33%1/3
A || B
A= $cathash->{$a}{'order'}B= $a cmp $b
Truth table50%1/2
A
A= $cathash->{$b}{'order'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | or $a cmp $b | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 76 | grep { not /^(?:catname|type|options|order)$/ } keys %$cathash | |||||||||||||||||||||||||||||||||||||||||||||
| 251 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 28 | ▶ | if ( $cathash->{$catkey}->{type} eq "category" ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 255 | push @$categories, | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 12 | $self->_buildCategoryHash( $req, $catkey, $cathash->{$catkey}, | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | $catlevel + 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 24 | my $categoryHash = { | |||||||||||||||||||||||||||||||||||||||||||||
| 262 | category => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | catname => $catname, | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | catid => $catid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | catlevel => $catlevel | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 24 | ▶ | $categoryHash->{applications} = $applications if $applications; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 24 | ▶ | $categoryHash->{categories} = $categories if $categories; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 24 | return $categoryHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ## @method private hashref _buildApplicationHash(string appid, hashref apphash) | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # Build hash for an application | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # @param $appid Application ID | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # @param $apphash Hash of application elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | # @return Application Hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 16 | ▶ | sub _buildApplicationHash { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_buildApplicationHash: called CC=14 SCAR=36.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 16 | my ( $self, $appid, $apphash ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | my $applications; | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # Get application items | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 16 | ▶ | my $appname = $apphash->{options}->{name} || $appid; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$apphash->{'options'}{'name'} || $appid
MC/DC0%0/2
$apphash->{'options'}{'name'} || $appid
$apphash->{'options'}{'name'}
$appid
Truth table33%1/3
A || B
A= $apphash->{'options'}{'name'}B= $appid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 16 | ▶ | my $appuri = $apphash->{options}->{uri} || ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$apphash->{'options'}{'uri'} || ''
MC/DC0%0/1
$apphash->{'options'}{'uri'} || ''
$apphash->{'options'}{'uri'}
Truth table50%1/2
A
A= $apphash->{'options'}{'uri'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 16 | my $appdesc = $apphash->{options}->{description}; | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | 16 | my $applogo = $apphash->{options}->{logo}; | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | 16 | ▶ | my $applogo_icon = ( $apphash->{options}->{logo} =~ /\./ ? 0 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 16 | ▶ | my $apptip = $apphash->{options}->{tooltip} || $appname; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$apphash->{'options'}{'tooltip'} || $appname
MC/DC0%0/2
$apphash->{'options'}{'tooltip'} || $appname
$apphash->{'options'}{'tooltip'}
$appname
Truth table66%2/3
A || B
A= $apphash->{'options'}{'tooltip'}B= $appname
| |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # Detect sub applications | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 16 | my $subapphash; | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | 16 | foreach my $key ( sort keys %$apphash ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | 32 | ▶ | next if $key =~ /(type|options|catname|order)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if ( $apphash->{$key}->{type} eq "application" ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $subapphash->{$key} = $apphash->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # Display sub applications | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 16 | ▶ | if ( scalar keys %$subapphash > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | foreach my $appkey ( | |||||||||||||||||||||||||||||||||||||||||||||
| 301 | sort { | ||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ( $subapphash->{$a}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | <=> ( $subapphash->{$b}->{order} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/7
($subapphash->{$a}{'order'} || 0) <=> ($subapphash->{$b}{'order'} || 0) || $a cmp $b
$subapphash->{$a}{'order'} || 0
$subapphash->{$b}{'order'} || 0
MC/DC0%0/2
($subapphash->{$a}{'order'} || 0) <=> ($subapphash->{$b}{'order'} || 0) || $a cmp $b
$subapphash->{$a}{'order'}
$a cmp $b
MC/DC0%0/1
$subapphash->{$b}{'order'} || 0
$subapphash->{$b}{'order'}
Truth table0%0/3
A || B
A= $subapphash->{$a}{'order'}B= $a cmp $b
Truth table0%0/2
A
A= $subapphash->{$b}{'order'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | or $a cmp $b | ||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | keys %$subapphash | ||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | push @$applications, | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->_buildApplicationHash( $appkey, $subapphash->{$appkey} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 16 | my $applicationHash = { | |||||||||||||||||||||||||||||||||||||||||||||
| 315 | application => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | appname => $appname, | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | appuri => $appuri, | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | appdesc => $appdesc, | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | applogo => $applogo, | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | applogo_icon => $applogo_icon, | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | appid => $appid, | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | apptip => $apptip, | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 16 | ▶ | $applicationHash->{applications} = $applications if $applications; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 16 | return $applicationHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ## @method private string _filter(hashref apphash) | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # Duplicate hash reference | ||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # Remove unauthorized menu elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # Hide empty categories | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # @param $apphash Menu elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # @return filtered hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 12 | ▶ | sub _filter { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 12 | my ( $self, $req, $apphash ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 336 | 12 | my $filteredHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 337 | my $key; | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # Copy hash reference into a new hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 12 | foreach $key ( keys %$apphash ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | 20 | $filteredHash->{$key} = $apphash->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # Filter hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 12 | $self->_filterHash( $req, $filteredHash ); | |||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # Hide empty categories | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 12 | $self->_isCategoryEmpty($filteredHash); | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 12 | return $filteredHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||
| 353 | ## @method private string _filterHash(hashref apphash, string currentpath) | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # Remove unauthorized menu elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # @param $apphash Menu elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # @param $currentpath Path of the parent node in the menu tree, used as a | ||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # qualified cache key for compiled "display" rules so that two homonymous | ||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # applications living in distinct categories do not share the same rule. | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # @return filtered hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 56 | ▶ | sub _filterHash { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filterHash: called CC=20 SCAR=34.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 56 | my ( $self, $req, $apphash, $currentpath ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 56 | ▶ | $currentpath //= ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$currentpath //= ""
MC/DC100%1/1
$currentpath //= ""
$currentpath
Truth table100%2/2
A
A= $currentpath
| |||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 56 | foreach my $key ( keys %$apphash ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 365 | 132 | ▶ | next if $key =~ /(type|options|catname|order)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 44 | ▶ | my $path = $currentpath ? "$currentpath/$key" : $key; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 44 | ▶ | if ( $apphash->{$key}->{type} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "category"
MC/DC50%1/2
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "category"
$apphash->{$key}{"type"}
$apphash->{$key}{"type"} eq "category"
Truth table66%2/3
A and B
A= $apphash->{$key}{"type"}B= $apphash->{$key}{"type"} eq "category"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | and $apphash->{$key}->{type} eq "category" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # Filter the category | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 20 | $self->_filterHash( $req, $apphash->{$key}, $path ); | |||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 44 | ▶ | if ( $apphash->{$key}->{type} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "application"
MC/DC50%1/2
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "application"
$apphash->{$key}{"type"}
$apphash->{$key}{"type"} eq "application"
Truth table66%2/3
A and B
A= $apphash->{$key}{"type"}B= $apphash->{$key}{"type"} eq "application"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 375 | and $apphash->{$key}->{type} eq "application" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # Filter sub applications | ||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 24 | $self->_filterHash( $req, $apphash->{$key}, $path ); | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # Check rights | ||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 24 | $self->logger->debug("Checking display condition for $path"); | |||||||||||||||||||||||||||||||||||||||||||||
| 383 | my $appdisplay = $apphash->{$key}->{options}->{display} | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 24 | ▶ | || "auto"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$apphash->{$key}{'options'}{'display'} || 'auto'
MC/DC0%0/1
$apphash->{$key}{'options'}{'display'} || 'auto'
$apphash->{$key}{'options'}{'display'}
Truth table50%1/2
A
A= $apphash->{$key}{'options'}{'display'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 24 | $apphash->{$key}->{options}->{uri} =~ URIRE; | |||||||||||||||||||||||||||||||||||||||||||||
| 386 | 24 | my ( $vhost, $appuri ) = ( $3, $5 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | 24 | $vhost = $self->p->HANDLER->resolveAlias($vhost); | |||||||||||||||||||||||||||||||||||||||||||||
| 388 | 24 | $appuri = $self->p->HANDLER->canonicalUri($appuri); | |||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # Remove if display is "no" or "off" | ||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 24 | ▶ | delete $apphash->{$key} and next if ( $appdisplay =~ /^(no|off)$/ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$appdisplay =~ /^(no|off)$/ && (delete $apphash->{$key} && (next))
delete $apphash->{$key} and next
MC/DC0%0/2
$appdisplay =~ /^(no|off)$/ && (delete $apphash->{$key} && (next))
$appdisplay =~ /^(no|off)$/
delete $apphash->{$key}
Truth table33%1/3
A && B
A= $appdisplay =~ /^(no|off)$/B= delete $apphash->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # Keep node if display is "yes" or "on" | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 24 | ▶ | next if ( $appdisplay =~ /^(yes|on)$/ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 24 | my $cond = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # Handle partner rules (SAML, CAS or OIDC) | ||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 24 | ▶ | if ( $appdisplay =~ /^sp:\s*(.*)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $p = $1; | |||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ( my $sub = $self->p->spRules->{$p} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | delete $apphash->{$key} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | unless ( $sub->( $req, $req->userData ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 405 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $self->logger->error("Partner rule $p returns: $@"); | |||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # If a specific rule exists, get it from cache or compile it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # The cache key includes the full path because two applications | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # in different categories may share the same short name with | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # different display rules (#3612). | ||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 24 | ▶ | if ( $appdisplay !~ /^auto$/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 16 | ▶ | if ( $self->specific->{$path} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | $cond = $self->specific->{$path}; | |||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 421 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 8 | $cond = $self->specific->{$path} = | |||||||||||||||||||||||||||||||||||||||||||||
| 423 | $self->p->HANDLER->buildSub( | ||||||||||||||||||||||||||||||||||||||||||||||
| 424 | $self->p->HANDLER->substitute($appdisplay) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # Check grant function if display is "auto" (this is the default) | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 24 | ▶ | delete $apphash->{$key} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | unless ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | $self->p->HANDLER->grant( | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | $req, $req->userData, $appuri, $cond, $vhost | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 434 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 24 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ## @method private void _isCategoryEmpty(hashref apphash) | ||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # Check if a category is empty | ||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # @param $apphash Menu elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # @return boolean | ||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 32 | ▶ | sub _isCategoryEmpty { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_isCategoryEmpty: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 32 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 447 | 32 | my ($apphash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 448 | 32 | my $key; | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # Test sub categories | ||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 32 | foreach $key ( keys %$apphash ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | 76 | ▶ | next if $key =~ /(type|options|catname|order)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 36 | ▶ | if ( $apphash->{$key}->{type} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "category"
MC/DC50%1/2
$apphash->{$key}{"type"} and $apphash->{$key}{"type"} eq "category"
$apphash->{$key}{"type"}
$apphash->{$key}{"type"} eq "category"
Truth table66%2/3
A and B
A= $apphash->{$key}{"type"}B= $apphash->{$key}{"type"} eq "category"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 454 | and $apphash->{$key}->{type} eq "category" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 455 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 456 | delete $apphash->{$key} | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 20 | ▶ | if $self->_isCategoryEmpty( $apphash->{$key} ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # Test this category | ||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 32 | ▶ | if ( $apphash->{type} and $apphash->{type} eq "category" ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$apphash->{"type"} and $apphash->{"type"} eq "category"
MC/DC50%1/2
$apphash->{"type"} and $apphash->{"type"} eq "category"
$apphash->{"type"}
$apphash->{"type"} eq "category"
Truth table66%2/3
A and B
A= $apphash->{"type"}B= $apphash->{"type"} eq "category"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # Temporary store 'options' | ||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 20 | my $tmp_options = $apphash->{options}; | |||||||||||||||||||||||||||||||||||||||||||||
| 466 | 20 | my $tmp_catname = $apphash->{catname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 467 | 20 | my $tmp_order = $apphash->{order}; | |||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 20 | delete $apphash->{type}; | |||||||||||||||||||||||||||||||||||||||||||||
| 470 | 20 | delete $apphash->{options}; | |||||||||||||||||||||||||||||||||||||||||||||
| 471 | 20 | delete $apphash->{catname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 472 | 20 | delete $apphash->{order}; | |||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 20 | ▶ | if ( scalar( keys %$apphash ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # There are sub categories or sub applications | ||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # Restore type and options | ||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 12 | $apphash->{type} = "category"; | |||||||||||||||||||||||||||||||||||||||||||||
| 479 | 12 | $apphash->{options} = $tmp_options; | |||||||||||||||||||||||||||||||||||||||||||||
| 480 | 12 | $apphash->{catname} = $tmp_catname; | |||||||||||||||||||||||||||||||||||||||||||||
| 481 | 12 | $apphash->{order} = $tmp_order; | |||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # Return false | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 12 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 486 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||
| 488 | # Return true | ||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 8 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 12 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | sub _register_tab { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_tab: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my ( $self, $plugin ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | my $rule_text = $plugin->rule // "1"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$plugin->rule // 1
MC/DC0%0/1
$plugin->rule // 1
$plugin->rule
Truth table0%0/2
A
A= $plugin->rule
| |||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $name = $plugin->name; | |||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | if ( !$name ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $self->logger->warn("Could not load custom menu tab: missing name"); | |||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $compiled_rule = | |||||||||||||||||||||||||||||||||||||||||||||
| 507 | $self->p->buildRule( $rule_text, "Rule for $name custom tab" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if ( !$compiled_rule ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | push @{ $self->menuModules }, [ $name, $compiled_rule, $plugin ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # Sort menuModules array | ||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | @{ $self->menuModules } = $self->_sort_menu( $self->menuModules, | |||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | $self->conf->{portalDisplayOrder} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # This function does the sorting work and should be easy to test | ||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | sub _sort_menu { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sort_menu: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my ( $self, $menuToSort, $displayOrderString ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my @order = $self->_get_display_order($displayOrderString); | |||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | my $orderhash; | |||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | @$orderhash{@order} = 1 .. @order; | |||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # If the position of unknown plugins was not specified, put them at the end | ||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | $orderhash->{_unknown} //= @order + 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$orderhash->{"_unknown"} //= @order + 1
MC/DC0%0/1
$orderhash->{"_unknown"} //= @order + 1
$orderhash->{"_unknown"}
Truth table0%0/2
A
A= $orderhash->{"_unknown"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | return sort { _sort_menu_helper( $orderhash, $a, $b ) } @$menuToSort; | |||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # Sort helper based on portalDisplayOrder | ||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # orderhash is a name => position hash | ||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # You can use "_unknown" in portalDisplayOrder as a placeholder for plugins of unknown position | ||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | sub _sort_menu_helper { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sort_menu_helper: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my ( $orderhash, $a, $b ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||
| 540 | return ( $orderhash->{ $a->[0] } || $orderhash->{_unknown} || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | <=> ( $orderhash->{ $b->[0] } || $orderhash->{_unknown} || 0 ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/10
$$orderhash{$a->[0]} || $orderhash->{'_unknown'} || 0
$$orderhash{$a->[0]} or $orderhash->{"_unknown"}
$$orderhash{$b->[0]} || $orderhash->{'_unknown'} || 0
$$orderhash{$b->[0]} or $orderhash->{"_unknown"}
MC/DC0%0/2
$$orderhash{$a->[0]} || $orderhash->{'_unknown'} || 0
$$orderhash{$a->[0]}
$orderhash->{"_unknown"}
MC/DC0%0/2
$$orderhash{$b->[0]} || $orderhash->{'_unknown'} || 0
$$orderhash{$b->[0]}
$orderhash->{"_unknown"}
Truth table0%0/3
A or B
A= $$orderhash{$a->[0]}B= $orderhash->{"_unknown"}
Truth table0%0/3
A or B
A= $$orderhash{$b->[0]}B= $orderhash->{"_unknown"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 8 | ▶ | sub _get_display_order { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_display_order: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 8 | my ( $self, $displayOrderString ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 546 | 8 | my %hash; | |||||||||||||||||||||||||||||||||||||||||||||
| 547 | 8 | return grep { !$hash{$_}++ } split /[,\s]+/, $displayOrderString,; | |||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 454 | 1; | |||||||||||||||||||||||||||||||||||||||||||||