blib/lib/Lemonldap/NG/Portal/Main/Init.pm

filter: Statementstmt 85.0% 323 / 380 Branchbran 70.1% 80 / 114 Conditioncond 51.3% 37 / 72 MC/DCmcdc 17.5% 7 / 40 Subroutinesub 88.0% 44 / 50 Podpod 0.0% 0 / 13 totaltotal 73.3% 491 / 669 CC 107 SCAR 40.3
CC
107
Cov
78%
findEP
176.5
reloadConf
46.5
init
11.5
CRAP 56.2
« blib/lib/Lemonldap/NG/Portal/Plugins/Notifications.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/UserDB/Demo.pm »
1 ##@class Lemonldap::NG::Portal::Main::Init
2 # Initialization part of Lemonldap::NG portal
3 #
4 # 2 public methods:
5 # - init(): launch at startup. Load 'portal' section of lemonldap-ng.ini,
6 # initialize default route and launch reloadConf()
7 # - reloadConf(): (re)load configuration using localConf (ie 'portal' section
8 # of lemonldap-ng.ini) and underlying handler configuration
9 package Lemonldap::NG::Portal::Main::Init;
10  
11 454 our $VERSION = '2.23.0';
12  
13 package Lemonldap::NG::Portal::Main;
14  
15 454 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 454 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 454 ▶use Regexp::Assemble;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 454 ▶use Lemonldap::NG::Common::Util qw(getSameSite);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 454 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 454 ▶use Lemonldap::NG::Portal;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 454 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 454 ▶use Digest::SHA;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 # PROPERTIES
25  
26 # Configuration storage
27 496 ▶has localConfig => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
28 496 ▶has conf => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
29 496 ▶has trOver => ( is => 'rw', default => sub { { all => {} } } );
Subroutine __ANON__: called CC=1 SCAR=0.0
30  
31 # Sub modules
32 454 has _authentication => ( is => 'rw' );
33 454 has _userDB => ( is => 'rw' );
34 454 has _passwordDB => ( is => 'rw' );
35  
36 496 ▶has _loadedServices => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
37 496 ▶has _loadedPlugins => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
38  
39 # Legacy
40 0 ▶sub _captcha { $_[0]->getService('captcha') }
Subroutine _captcha: not called CC=1 SCAR=6.9
41 0 ▶sub _trustedBrowser { $_[0]->getService('trustedBrowser') }
Subroutine _trustedBrowser: not called CC=1 SCAR=6.9
42 276 ▶sub _sfEngine { $_[0]->getService('secondFactor') }
Subroutine _sfEngine: called CC=1 SCAR=0.0
43 12 ▶sub menu { $_[0]->getService('menu') }
Subroutine menu: called CC=1 SCAR=0.0
Pod undocumented
44  
45 496 ▶has _ppRules => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
46  
47 454 has loadedModules => ( is => 'rw' );
48  
49 # Macros and groups
50 454 has _macros => ( is => 'rw' );
51 454 has _groups => ( is => 'rw' );
52 454 has _jsRedirect => ( is => 'rw' );
53  
54 # TrustedDomain regexp
55 454 has trustedDomainsRe => ( is => 'rw' );
56 496 ▶has additionalTrustedDomains => ( is => 'rw', default => sub { [] } );
Subroutine __ANON__: called CC=1 SCAR=0.0
57  
58 454 has cacheTag => ( is => 'rw' );
59  
60 # Entrypoints
61 has _pluginEntryPoints =>
62 496 ▶ ( is => 'rw', isa => 'ArrayRef', default => sub { [] } );
Subroutine __ANON__: called CC=1 SCAR=0.0
63  
64 # Lists to store plugins entry-points
65 454 my @entryPoints;
66  
67 454 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
68 454 @entryPoints = (
69  
70 # Auth process entrypoints
71 qw(beforeAuth betweenAuthAndData afterData endAuth),
72  
73 # Authenticated users entrypoint
74 'forAuthUser',
75  
76 # Logout entrypoint
77 'beforeLogout',
78  
79 # Special endpoint
80 'authCancel', # Clean pdata when user click on "cancel"
81 );
82  
83 454 foreach (@entryPoints) {
84 has $_ => (
85 is => 'rw',
86 isa => 'ArrayRef',
87 3472 ▶ default => sub { [] }
Subroutine __ANON__: called CC=1 SCAR=0.0
88 3178 );
89 }
90 }
91  
92 # Endpoints inserted after any main sub
93 496 ▶has afterSub => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
94 496 ▶has aroundSub => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
95  
96 # Issuer hooks
97 496 ▶has hook => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
98  
99 has spRules => (
100 is => 'rw',
101 496 ▶ default => sub { {} }
Subroutine __ANON__: called CC=1 SCAR=0.0
102 454 );
103  
104 # Custom template parameters
105 496 ▶has customParameters => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
106  
107 # Content-Security-Policy headers
108 454 has csp => ( is => 'rw' );
109  
110 # Cross-Origine Resource Sharing headers
111 454 has cors => ( is => 'rw' );
112  
113 # Cookie SameSite value
114 454 has cookieSameSite => ( is => 'rw' );
115  
116 # Plugins may declare the session data they want to store in login history here
117 has pluginSessionDataToRemember =>
118 496 ▶ ( is => 'rw', isa => "HashRef", default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
119  
120 # INITIALIZATION
121  
122 1167 ▶sub _resetPluginsAndServices {
Subroutine _resetPluginsAndServices: called CC=2 SCAR=6.9
123 1167 my ($self) = @_;
124 1167 $self->loadedModules( {} );
125 1167 $self->_loadedServices( {} );
126 1167 $self->_loadedPlugins( {} );
127 1167 $self->afterSub( {} );
128 1167 $self->aroundSub( {} );
129 1167 $self->spRules( {} );
130 1167 $self->hook( {} );
131 1167 $self->pluginSessionDataToRemember( {} );
132 1167 $self->_pluginEntryPoints( [] );
133  
134 # Reinitialize arrays
135 1167 foreach ( qw(_macros _groups), @entryPoints ) {
136 10503 $self->{$_} = [];
137 }
138 }
139  
140 496 ▶sub init {
Subroutine init: called CC=11 SCAR=24.4
Pod undocumented
141 496 my ( $self, $args ) = @_;
142 496 ▶ $args ||= {};
Condition50%1/2
$args ||= {}
l!l
4960
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
143 496 my $confAcc = Lemonldap::NG::Common::Conf->new( $args->{configStorage} );
144 496 ▶ unless ($confAcc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($confAcc) 0 496 496
145 0 die( 'Could not read configuration: '
146 . $Lemonldap::NG::Common::Conf::msg );
147 }
148 496 $self->localConfig( { %{ $confAcc->getLocalConf('portal') }, %$args } );
149  
150 # Load override messages from lemonldap-ng.ini
151 496 foreach my $k ( keys %{ $self->localConfig } ) {
152 12535 ▶ if ( $k =~ /tpl_(.*)/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($k =~ /tpl_(.*)/) { } 1 12534 12535
elsif ($k =~ /error_(?:(\w+?)_)?(\d+)$/) { } 1 12533 12534
elsif ($k =~ /msg_(?:([a-z][a-z](?:_[A-Z][A-Z])?)_)?(\w+)$/) { } 1 12532 12533
153 1 $self->customParameters->{$1} = $self->localConfig->{$k};
154 }
155 elsif ( $k =~ /error_(?:(\w+?)_)?(\d+)$/ ) {
156 1 ▶ my $lang = $1 || 'all';
Condition50%1/2
$1 || 'all'
l!l
10
MC/DC0%0/1
$1 || 'all'
$1
Truth table50%1/2
A
A= $1
Aresult
11
00
157 1 $self->trOver->{$lang}->{"PE$2"} = $self->localConfig->{$k};
158 }
159 elsif ( $k =~ /msg_(?:([a-z][a-z](?:_[A-Z][A-Z])?)_)?(\w+)$/ ) {
160 1 ▶ my $lang = $1 || 'all';
Condition50%1/2
$1 || 'all'
l!l
01
MC/DC0%0/1
$1 || 'all'
$1
Truth table50%1/2
A
A= $1
Aresult
11
00
161 1 $self->trOver->{$lang}->{$2} = $self->localConfig->{$k};
162 }
163 else {
164 12532 $self->conf->{$k} = $self->localConfig->{$k};
165 }
166 }
167 496 $self->trOver( JSON::to_json( $self->trOver ) );
168  
169 # Purge loaded module list
170 496 $self->_resetPluginsAndServices;
171  
172 # Insert `reloadConf` in handler reload stack
173 496 Lemonldap::NG::Handler::Main->onReload( $self, 'reloadConf' );
174  
175 # Register logout event (unlog event is only a local unlog: clean cache)
176 &Lemonldap::NG::Handler::Main::MsgActions::addMsgAction(
177 'logout',
178 2 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
179 2 my ( $class, $id, $req ) = @_;
180 2 return $self->eventLogout( $req, $id );
181 }
182 496 );
183  
184 # Handler::PSGI::Try initialization
185 496 ▶ unless ( $self->SUPER::init( $self->localConfig ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->SUPER::init($self->localConfig)) 342 154 496
186 342 $self->logger->error( 'Initialization failed: ' . $self->error );
187 342 return 0;
188 }
189 154 ▶ if ( $self->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->error) 0 154 154
190 0 $self->logger->error( $self->error );
191 0 return 0;
192 }
193  
194 # Default routes must point to routines declared above
195 154 $self->defaultAuthRoute('');
196 154 $self->defaultUnauthRoute('');
197 154 return 1;
198 }
199  
200 671 ▶sub setPortalRoutes {
Subroutine setPortalRoutes: called CC=1 SCAR=0.0
Pod undocumented
201 671 my ($self) = @_;
202 671 $self->authRoutes( {
203 GET => {},
204 POST => {},
205 PUT => {},
206 PATCH => {},
207 DELETE => {},
208 OPTIONS => {}
209 }
210 );
211 671 $self->unAuthRoutes( {
212 GET => {},
213 POST => {},
214 PUT => {},
215 PATCH => {},
216 DELETE => {},
217 OPTIONS => {}
218 }
219 );
220 671 $self
221  
222 # "/" or undeclared paths
223 ->addUnauthRoute( '*' => 'login', ['GET'] )
224 ->addUnauthRoute( '*' => 'postLogin', ['POST'] )
225 ->addAuthRoute( '*' => 'authenticatedRequest', ['GET'] )
226 ->addAuthRoute( '*' => 'postAuthenticatedRequest', ['POST'] )
227  
228 # psgi.js
229 ->addUnauthRoute( 'psgi.js' => 'sendJs', ['GET'] )
230 ->addAuthRoute( 'psgi.js' => 'sendJs', ['GET'] )
231  
232 # portal.css
233 ->addUnauthRoute( 'portal.css' => 'sendCss', ['GET'] )
234 ->addAuthRoute( 'portal.css' => 'sendCss', ['GET'] )
235  
236 # lmerror
237 ->addUnauthRoute( lmerror => { ':code' => 'lmError' }, ['GET'] )
238 ->addAuthRoute( lmerror => { ':code' => 'lmError' }, ['GET'] )
239  
240 # Core REST API
241 ->addUnauthRoute( ping => 'pleaseAuth', ['GET'] )
242 ->addAuthRoute( ping => 'authenticated', ['GET'] )
243  
244 # Refresh session
245 ->addAuthRoute( refresh => 'refresh', ['GET'] )
246  
247 ->addAuthRoute( '*' => 'corsPreflight', ['OPTIONS'] )
248 ->addUnauthRoute( '*' => 'corsPreflight', ['OPTIONS'] )
249  
250 # Logout
251 ->addAuthRoute( logout => 'logout', ['GET'] )
252 ->addUnauthRoute( logout => 'unauthLogout', ['GET'] );
253  
254 # Default routes must point to routines declared above
255 671 $self->defaultAuthRoute('');
256 671 $self->defaultUnauthRoute('');
257 671 return 1;
258  
259 }
260  
261 671 ▶sub reloadConf {
Subroutine reloadConf: called CC=40 SCAR=38.4
Pod undocumented
262 671 my ( $self, $conf ) = @_;
263  
264 # Store default portal value in $self->portal
265 671 $self->portal( Lemonldap::NG::Handler::Main->tsv->{portal}->() );
266  
267 # Handle requests (other path may be declared in enabled plugins)
268 671 $self->setPortalRoutes;
269  
270 # Reinitialize $self->conf
271 671 %{ $self->{conf} } = %{ $self->localConfig };
272  
273 # Purge loaded module list
274 671 $self->_resetPluginsAndServices;
275  
276 # Load conf in portal object
277 671 foreach my $key ( keys %$conf ) {
278 279653 ▶ $self->{conf}->{$key} ||= $conf->{$key};
Condition100%3/3
$self->{"conf"}{$key} ||= $conf->{$key}
l!l&&r!l&&!r
1449121743547727
MC/DC100%2/2
$self->{"conf"}{$key} ||= $conf->{$key}
$self->{"conf"}{$key} $conf->{$key}
Truth table100%3/3
A ||= B
A= $self->{"conf"}{$key}B= $conf->{$key}
ABresult
1X1
011
000
279 }
280  
281 # Initialize content-security-policy headers
282 671 my $csp = '';
283 671 foreach (qw(default img src style font connect script)) {
284 4697 my $prm = $self->conf->{ 'csp' . ucfirst($_) };
285 4697 ▶ $csp .= "$_-src $prm;" if ($prm);
Branch: 1 branch
BranchTrueFalseTotal
if $prm 4026 671 4697
286 }
287 671 $self->csp($csp);
288 671 $self->logger->debug( "Initialized CSP headers : " . $self->csp );
289  
290 # Initialize Cross-Origin Resource Sharing headers
291 671 my $cors = '';
292 671 foreach (
293 qw(Allow_Origin Allow_Credentials Allow_Headers Allow_Methods Expose_Headers Max_Age)
294 )
295 {
296 4026 my $header = $_;
297 4026 my $prm = $self->conf->{ 'cors' . $_ };
298 4026 ▶ if ( $header and $prm ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header and $prm) 4025 1 4026
Condition66%2/3
$header and $prm
!ll&&!rl&&r
014025
MC/DC50%1/2
$header and $prm
$header $prm
Truth table66%2/3
A and B
A= $headerB= $prm
ABresult
0X0
100
111
299 4025 $header =~ s/_/-/;
300 4025 $prm =~ s/\s+//;
301 4025 $cors .= "Access-Control-$header;$prm;";
302 }
303 }
304 671 $self->cors($cors);
305 671 $self->logger->debug( "Initialized CORS headers : " . $self->cors );
306  
307 671 ▶ $self->{staticPrefix} = $self->conf->{staticPrefix} || '/static';
Condition50%1/2
$self->conf->{'staticPrefix'} || '/static'
l!l
6710
MC/DC0%0/1
$self->conf->{'staticPrefix'} || '/static'
$self->conf->{'staticPrefix'}
Truth table50%1/2
A
A= $self->conf->{'staticPrefix'}
Aresult
11
00
308 671 ▶ $self->{languages} = $self->conf->{languages} || 'en';
Condition100%2/2
$self->conf->{'languages'} || 'en'
l!l
6701
MC/DC100%1/1
$self->conf->{'languages'} || 'en'
$self->conf->{'languages'}
Truth table100%2/2
A
A= $self->conf->{'languages'}
Aresult
11
00
309  
310 # Initialize session DBs
311 671 ▶ unless ( $self->conf->{globalStorage} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->conf->{"globalStorage"}) 0 671 671
312 0 $self->error(
313 'globalStorage not defined (perhaps configuration can not be read)'
314 );
315 0 return $self->fail;
316 }
317  
318 # Initialize persistent session DB
319 671 ▶ unless ( $self->conf->{persistentStorage} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->conf->{"persistentStorage"}) 669 2 671
320 669 $self->conf->{persistentStorage} = $self->conf->{globalStorage};
321 $self->conf->{persistentStorageOptions} =
322 669 $self->conf->{globalStorageOptions};
323 }
324  
325 # Initialize cookie SameSite value
326 671 $self->cookieSameSite( getSameSite( $self->conf ) );
327 671 $self->logger->debug(
328 "Cookies will use SameSite=" . $self->cookieSameSite );
329  
330 # Set asset tag from version and optional salt
331 671 ▶ my $cacheTagSalt = $self->conf->{cacheTagSalt} // "";
Condition100%2/2
$self->conf->{"cacheTagSalt"} // ""
l!l
5666
MC/DC100%1/1
$self->conf->{"cacheTagSalt"} // ""
$self->conf->{"cacheTagSalt"}
Truth table100%2/2
A
A= $self->conf->{"cacheTagSalt"}
Aresult
11
00
332 671 ▶ my $key = $self->conf->{key} // "";
Condition50%1/2
$self->conf->{"key"} // ""
l!l
6710
MC/DC0%0/1
$self->conf->{"key"} // ""
$self->conf->{"key"}
Truth table50%1/2
A
A= $self->conf->{"key"}
Aresult
11
00
333 671 my $digest = substr(
334 MIME::Base64::encode_base64url(
335 Digest::SHA::hmac_sha256(
336 $Lemonldap::NG::Portal::VERSION . $cacheTagSalt, $key
337 )
338 ),
339 0, 8
340 );
341 671 $self->cacheTag($digest);
342  
343 # Load menu
344 # ---------
345 671 $self->displayInit;
346  
347 # Load authentication/userDB
348 # --------------------------
349 671 my $mod;
350 671 for my $type (qw(authentication userDB)) {
351 1342 ▶ unless ( $self->conf->{$type} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->conf->{$type}) 0 1342 1342
352 0 $self->error("$type is not set");
353 0 return $self->fail;
354 }
355 $mod = $self->conf->{$type}
356 1342 ▶ unless ( $self->conf->{$type} eq 'Same' );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->conf->{$type} eq "Same" 707 635 1342
357 1342 my $module = '::' . ucfirst($type) . '::' . $mod;
358 1342 $module =~ s/Authentication/Auth/;
359  
360 # Launch and initialize module
361 return $self->fail
362 1342 ▶ unless ( $self->{"_$type"} = $self->loadPlugin($module) );
Branch: 1 branch
BranchTrueFalseTotal
unless $$self{"_$type"} = $self->loadPlugin($module) 0 1342 1342
363 }
364  
365 # Compile macros in _macros, groups in _groups
366 671 foreach my $type (qw(macros groups)) {
367 1342 $self->{"_$type"} = {};
368 1342 ▶ if ( $self->conf->{$type} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->conf->{$type}) 1342 0 1342
369 1342 for my $name ( sort keys %{ $self->conf->{$type} } ) {
370 my $sub =
371 HANDLER->buildSub(
372 4664 HANDLER->substitute( $self->conf->{$type}->{$name} ) );
373 4664 ▶ if ($sub) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sub) { } 4664 0 4664
374 4664 $self->{"_$type"}->{$name} = $sub;
375 }
376 else {
377 $self->logger->error( "$type $name returns an error: "
378 0 . HANDLER->tsv->{jail}->error );
379 }
380 }
381 }
382 }
383 $self->{_jsRedirect} =
384 HANDLER->buildSub( HANDLER->substitute( $self->conf->{jsRedirect} ) )
385 or $self->logger->error(
386 671 ▶ 'jsRedirect returns an error: ' . HANDLER->tsv->{jail}->error );
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_jsRedirect"} = "Lemonldap::NG::Handler::PSGI::Main"->buildSub("Lemonldap::NG::Handler::PSGI::Main"->substitute($self->conf->{"jsRedirect"})) or $self->logger->error('jsRedirect returns an error: ' . "Lemonldap::NG::Handler::PSGI::Main"->tsv->{"jail"}->error) 671 0 671
387  
388 # Load services
389 671 foreach my $service ( $self->enabledServices ) {
390 2021 ▶ $self->loadService(@$service) or return $self->fail;
Branch: 1 branch
BranchTrueFalseTotal
$self->loadService(@$service) or return $self->fail 1681 340 2021
391 }
392  
393 # Load plugins
394 331 foreach my $plugin ( $self->enabledPlugins ) {
395 1818 ▶ $self->loadPlugin($plugin) or return $self->fail;
Branch: 1 branch
BranchTrueFalseTotal
$self->loadPlugin($plugin) or return $self->fail 1818 0 1818
396 }
397  
398 # Initialize trusted domain regexp
399 331 ▶ if ( $self->conf->{trustedDomains}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->conf->{'trustedDomains'} and $self->conf->{'trustedDomains'} =~ /^\s*\*\s*$/) { } 0 331 331
Condition66%2/3
$self->conf->{"trustedDomains"} and $self->conf->{"trustedDomains"} =~ /^\s*\*\s*$/
!ll&&!rl&&r
296350
MC/DC0%0/2
$self->conf->{"trustedDomains"} and $self->conf->{"trustedDomains"} =~ /^\s*\*\s*$/
$self->conf->{"trustedDomains"} $self->conf->{"trustedDomains"} =~ /^\s*\*\s*$/
Truth table66%2/3
A and B
A= $self->conf->{"trustedDomains"}B= $self->conf->{"trustedDomains"} =~ /^\s*\*\s*$/
ABresult
0X0
100
111
400 and $self->conf->{trustedDomains} =~ /^\s*\*\s*$/ )
401 {
402 0 $self->trustedDomainsRe(qr#^https?://#);
403 }
404 else {
405 331 my $re = Regexp::Assemble->new();
406 331 ▶ if ( my $td = $self->conf->{trustedDomains} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $td = $self->conf->{"trustedDomains"}) 35 296 331
407 35 $td =~ s/^\s*(.*?)\s*/$1/;
408 35 foreach ( split( /\s+/, $td ) ) {
409 69 ▶ next unless ($td);
Branch: 1 branch
BranchTrueFalseTotal
unless $td 0 69 69
410 69 s#^\.#([^/]+\.)?#;
411 69 $self->logger->debug("Domain $_ added in trusted domains");
412 69 s/\./\\./g;
413  
414 # This regexp is valid for the followings hosts:
415 # - $td
416 # - $domainlabel.$td
417 # $domainlabel is build looking RFC2396
418 # (see Regexp::Common::URI::RFC2396)
419 69 $_ =~
420 s/\*\\\./(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9]\\.)*/g;
421 69 $re->add("$_");
422 }
423 }
424 331 my $default_portal = HANDLER->tsv->{portal}->();
425 331 foreach ( @{ $self->{additionalTrustedDomains} }, $default_portal ) {
426 514 my $p = $_;
427 514 $p =~ s#https?://([^/]*).*$#$1#;
428 514 $re->add( quotemeta($p) );
429 }
430  
431 331 foreach my $vhost ( sort keys %{ $self->conf->{locationRules} } ) {
432 2297 my $expr = quotemeta($vhost);
433  
434 # Handle wildcards
435 2297 ▶ if ( $vhost =~ /[\%\*]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($vhost =~ /[\%\*]/) 654 1643 2297
436 654 $expr =~ s/\\\*/[A-Za-z0-9\-\.]\*/;
437 654 $expr =~ s/\\\%/[A-Za-z0-9\-]\*/;
438 }
439 2297 $re->add($expr);
440 2297 $self->logger->debug("Vhost $vhost added in trusted domains");
441 2297 ▶ $self->conf->{vhostOptions} ||= {};
Condition50%1/2
$self->conf->{"vhostOptions"} ||= {}
l!l
22970
MC/DC0%0/1
$self->conf->{"vhostOptions"} ||= {}
$self->conf->{"vhostOptions"}
Truth table50%1/2
A
A= $self->conf->{"vhostOptions"}
Aresult
11
00
442 2297 ▶ if ( my $tmp =
Branch: 1 branch
BranchTrueFalseTotal
if (my $tmp = $self->conf->{"vhostOptions"}{$vhost}{"vhostAliases"}) 0 2297 2297
443 $self->conf->{vhostOptions}->{$vhost}->{vhostAliases} )
444 {
445 0 foreach my $alias ( split /\s+/, $tmp ) {
446 0 $self->logger->debug(
447 "Alias $alias added in trusted domains");
448 0 $re->add( quotemeta($alias) );
449 }
450 }
451 }
452  
453 331 my $tmp = '^https?://' . $re->as_string . '(?::\d+)?(?:/|$)';
454 331 $self->trustedDomainsRe(qr/$tmp/);
455  
456 }
457  
458 # Clean $req->pdata after authentication
459 331 push @{ $self->endAuth }, "cleanPdata";
460  
461 # Failsafe: allow handler access to portal in case it's missing in conf
462 331 my $default_portal_uri = URI->new( HANDLER->tsv->{portal}->() );
463 331 my $default_portal_host = eval { $default_portal_uri->host };
464 331 ▶ if ($default_portal_host) {
Branch: 1 branch
BranchTrueFalseTotal
if ($default_portal_host) 331 0 331
465 331 ▶ HANDLER->tsv->{defaultCondition}->{$default_portal_host} ||= sub { 1 };
Subroutine __ANON__: called CC=1 SCAR=0.1
Condition66%2/3
"Lemonldap::NG::Handler::PSGI::Main"->tsv->{"defaultCondition"}{$default_portal_host} ||= sub { 1; }
l!l&&r!l&&!r
2301010
MC/DC0%0/2
"Lemonldap::NG::Handler::PSGI::Main"->tsv->{"defaultCondition"}{$default_portal_host} ||= sub { 1; }
"Lemonldap::NG::Handler::PSGI::Main"->tsv->{"defaultCondition"}{$default_portal_host} sub { 1; }
Truth table66%2/3
A ||= B
A= "Lemonldap::NG::Handler::PSGI::Main"->tsv->{"defaultCondition"}{$default_portal_host}B= sub { 1; }
ABresult
1X1
011
000
466 }
467  
468 331 1;
469 }
470  
471 # Method used to load plugins
472  
473 2021 ▶sub loadService {
Subroutine loadService: called CC=1 SCAR=0.0
Pod undocumented
474 2021 my ( $self, $name, $plugin ) = @_;
475 2021 $self->logger->debug("Loading service $name from $plugin");
476 2021 return $self->_loadedServices->{$name} = $self->loadPlugin($plugin);
477 }
478  
479 559 ▶sub getService {
Subroutine getService: called CC=1 SCAR=0.0
Pod undocumented
480 559 my ( $self, $name ) = @_;
481 559 return $_[0]->_loadedServices->{$name};
482 }
483  
484 5188 ▶sub loadPlugin {
Subroutine loadPlugin: called CC=8 SCAR=20.9
Pod undocumented
485 5188 my ( $self, $plugin ) = @_;
486 5188 ▶ unless ($plugin) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($plugin) 0 5188 5188
487 0 require Carp;
488 0 Carp::confess('Calling loadPugin without arg!');
489 }
490  
491 5188 ▶ my $full_name =
Branch: 1 branch
BranchTrueFalseTotal
$plugin =~ /^::/ ? : 5173 15 5188
492 ( $plugin =~ /^::/ ) ? "Lemonldap::NG::Portal$plugin" : $plugin;
493  
494 # Skip if already loaded (avoids double-loading when
495 # _loadConditionalPlugins and enabledPlugins both trigger the same plugin)
496 5188 ▶ return 1 if $self->loadedModules->{$full_name};
Branch: 1 branch
BranchTrueFalseTotal
if $self->loadedModules->{$full_name} 7 5181 5188
497  
498 5181 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (grep {my $item_full_name = $_ =~ /^::/ ? "Lemonldap::NG::Portal$_" : $_; $item_full_name eq $full_name;} split(/[\s,]+/, $self->conf->{"disabledPlugins"} // "", 0)) 2 5179 5181
499 grep {
500 25 ▶ my $item_full_name =
Branch: 1 branch
BranchTrueFalseTotal
$_ =~ /^::/ ? : 10 15 25
501 ( $_ =~ /^::/ ) ? "Lemonldap::NG::Portal$_" : $_;
502 25 ▶ $item_full_name eq $full_name
Condition100%2/2
$self->conf->{"disabledPlugins"} // ""
l!l
255156
MC/DC100%1/1
$self->conf->{"disabledPlugins"} // ""
$self->conf->{"disabledPlugins"}
Truth table100%2/2
A
A= $self->conf->{"disabledPlugins"}
Aresult
11
00
503 } split( /[\s,]+/, $self->conf->{disabledPlugins} // "" )
504 )
505 {
506 2 $self->logger->debug(
507 "Module $plugin is disallowed by disabledPlugins and was not loaded"
508 );
509 2 return 1;
510 }
511  
512 5179 ▶ return 0 unless ( my $obj = $self->loadModule($plugin) );
Branch: 1 branch
BranchTrueFalseTotal
unless my $obj = $self->loadModule($plugin) 340 4839 5179
513 4839 return $self->findEP( $plugin, $obj );
514 }
515  
516 # Insert declared entry points into corresponding arrays
517 5385 ▶sub findEP {
Subroutine findEP: called CC=37 SCAR=51.7
Pod undocumented
518 5385 my ( $self, $plugin, $obj ) = @_;
519  
520 5385 ▶ my $module = $plugin =~ /^::/ ? "Lemonldap::NG::Portal$plugin" : $plugin;
Branch: 1 branch
BranchTrueFalseTotal
$plugin =~ /^::/ ? : 5370 15 5385
521  
522 # Register the plugin's instance so that callbacks can be refered by a
523 # serializable string
524 # DEPRECATED: is_only=0 should no longer be supported after LLNG 3.
525 # Corresponding code paths must be removed
526 5385 my $is_only = 1;
527 5385 ▶ if ( $self->_loadedPlugins->{$module} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_loadedPlugins->{$module}) { } 323 5062 5385
528 323 $self->logger->debug("Plugin $module has already been loaded once.");
529 323 $is_only = 0;
530 }
531 else {
532 5062 $self->_loadedPlugins->{$module} = $obj;
533 }
534  
535 # Standards entry points
536 5385 foreach my $sub (@entryPoints) {
537 37695 ▶ if ( $obj->can($sub) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can($sub)) 2001 35694 37695
538 2001 $self->logger->debug(" Found $sub entry point in $module");
539 2001 ▶ if ( my $callback = $obj->$sub ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $callback = $obj->$sub) 2001 0 2001
540  
541 2001 ▶ if ($is_only) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_only) { } 1881 120 2001
542 1881 push @{ $self->{$sub} }, "${module}::${callback}";
543 }
544 else {
545 120 ▶ push @{ $self->{$sub} }, sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
546 56 eval {
547 56 $obj->logger->debug(
548 "Launching ${module}::$callback");
549 };
550 56 $obj->$callback(@_);
551 120 };
552 }
553 2001 $self->logger->debug(" -> $callback");
554 }
555 }
556 }
557 5385 ▶ if ( $obj->can('afterSub') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("afterSub")) 10 5375 5385
558 10 $self->logger->debug("Found afterSub in $module");
559 10 my $h = $obj->afterSub;
560 10 ▶ unless ( ref $h and ref($h) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $h and ref $h eq 'HASH') { } 10 0 10
Condition33%1/3
ref $h and ref $h eq "HASH"
!ll&&!rl&&r
0010
MC/DC0%0/2
ref $h and ref $h eq "HASH"
ref $h ref $h eq "HASH"
Truth table33%1/3
A and B
A= ref $hB= ref $h eq "HASH"
ABresult
0X0
100
111
561 0 $self->logger->error(
562 '"afterSub" endpoint must be a hashref, skipped');
563 }
564 else {
565 10 foreach my $ep ( keys %$h ) {
566 10 my $callback = $h->{$ep};
567 10 ▶ if ($is_only) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_only) { } 10 0 10
568 10 push @{ $self->afterSub->{$ep} }, "${module}::${callback}";
569 }
570 else {
571 0 ▶ push @{ $self->afterSub->{$ep} }, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
572 0 eval {
573 0 $obj->logger->debug(
574 "Launching ${module}::$callback afterSub $ep");
575 };
576 0 $obj->$callback(@_);
577 0 };
578 }
579 }
580 }
581 }
582 5385 ▶ if ( $obj->can('aroundSub') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("aroundSub")) 0 5385 5385
583 0 $self->logger->debug("Found aroundSub in $module");
584 0 my $h = $obj->aroundSub;
585 0 ▶ unless ( ref $h and ref($h) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $h and ref $h eq 'HASH') { } 0 0 0
Condition0%0/3
ref $h and ref $h eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $h and ref $h eq "HASH"
ref $h ref $h eq "HASH"
Truth table0%0/3
A and B
A= ref $hB= ref $h eq "HASH"
ABresult
0X0
100
111
586 0 $self->logger->error(
587 '"aroundSub" endpoint must be a hashref, skipped');
588 }
589 else {
590 0 foreach my $ep ( keys %$h ) {
591 0 my $callback = $h->{$ep};
592 0 ▶ my $previousSub = $self->aroundSub->{$ep} ||= sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
593 0 $self->logger->debug(
594 "$ep launched inside ${module}::$callback");
595 0 $self->$ep(@_);
596 0 ▶ };
Condition0%0/3
$self->aroundSub->{$ep} ||= sub { $self->logger->debug("$ep launched inside ${module}::$callback"); $self->$ep(@_); }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->aroundSub->{$ep} ||= sub { $self->logger->debug("$ep launched inside ${module}::$callback"); $self->$ep(@_); }
$self->aroundSub->{$ep} sub { $self->logger->debug("$ep launched inside ${module}::$callback"); $self->$ep(@_); }
Truth table0%0/3
A ||= B
A= $self->aroundSub->{$ep}B= sub { $self->logger->debug("$ep launched inside ${module}::$callback"); $self->$ep(@_); }
ABresult
1X1
011
000
597 0 ▶ $self->aroundSub->{$ep} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
598 0 $self->logger->debug(
599 "Launching ${module}::$callback instead of $ep");
600 0 $obj->$callback( $previousSub, @_ );
601 0 };
602 }
603 }
604 }
605 5385 ▶ if ( $obj->can('hook') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("hook")) 451 4934 5385
606 451 $self->logger->debug("Found hook in $module");
607 451 my $h = $obj->hook;
608 451 ▶ unless ( ref $h and ref($h) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $h and ref $h eq 'HASH') { } 451 0 451
Condition33%1/3
ref $h and ref $h eq "HASH"
!ll&&!rl&&r
00451
MC/DC0%0/2
ref $h and ref $h eq "HASH"
ref $h ref $h eq "HASH"
Truth table33%1/3
A and B
A= ref $hB= ref $h eq "HASH"
ABresult
0X0
100
111
609 0 $self->logger->error('"hook" endpoint must be a hashref, skipped');
610 }
611 else {
612 451 foreach my $hookname ( keys %$h ) {
613 513 my $callback = $h->{$hookname};
614 513 ▶ push @{ $self->hook->{$hookname} }, sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
615 12 eval {
616 12 $obj->logger->debug(
617 "Launching ${module}::$callback on hook $hookname");
618 };
619 12 $obj->$callback(@_);
620 513 };
621 }
622 }
623 }
624  
625 # Rules for menu
626 5385 ▶ if ( $obj->can('spRules') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("spRules")) 210 5175 5385
627 210 foreach my $k ( keys %{ $obj->spRules } ) {
628 $self->logger->info(
629 "$k is defined more than one time, it can have some bad effects on Menu display"
630 149 ▶ ) if ( $self->spRules->{$k} );
Branch: 1 branch
BranchTrueFalseTotal
if $self->spRules->{$k} 0 149 149
631 149 $self->spRules->{$k} = $obj->spRules->{$k};
632 }
633 }
634  
635 # Plugin entrypoints
636 5385 for my $ep ( @{ $self->_pluginEntryPoints } ) {
637 9820 ▶ if ( ( $ep->{can} and $obj->can( $ep->{can} ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($ep->{"can"} and $obj->can($ep->{"can"}) or $ep->{"isa"} and $obj->isa($ep->{"isa"}) or $ep->{"does"} and $obj->does($ep->{"does"})) 0 9820 9820
Condition46%7/15
$ep->{"can"} and $obj->can($ep->{"can"}) or $ep->{"isa"} and $obj->isa($ep->{"isa"}) or $ep->{"does"} and $obj->does($ep->{"does"})
l!l&&r!l&&!r
009820
$ep->{"can"} and $obj->can($ep->{"can"}) or $ep->{"isa"} and $obj->isa($ep->{"isa"})
l!l&&r!l&&!r
009820
$ep->{"can"} and $obj->can($ep->{"can"})
!ll&&!rl&&r
982000
$ep->{"isa"} and $obj->isa($ep->{"isa"})
!ll&&!rl&&r
282669940
$ep->{"does"} and $obj->does($ep->{"does"})
!ll&&!rl&&r
699428260
MC/DC0%0/6
$ep->{"can"} and $obj->can($ep->{"can"}) or $ep->{"isa"} and $obj->isa($ep->{"isa"}) or $ep->{"does"} and $obj->does($ep->{"does"})
$ep->{"can"} $obj->can($ep->{"can"}) $ep->{"isa"} $obj->isa($ep->{"isa"}) $ep->{"does"} $obj->does($ep->{"does"})
Truth table13%2/15
A and B or C and D or E and F
A= $ep->{"can"}B= $obj->can($ep->{"can"})C= $ep->{"isa"}D= $obj->isa($ep->{"isa"})E= $ep->{"does"}F= $obj->does($ep->{"does"})
ABCDEFresult
11XXXX1
0X11XX1
1011XX1
0X0X111
0X10111
100X111
1010111
0X0X0X0
0X0X100
0X100X0
0X10100
100X0X0
100X100
10100X0
1010100
638 or ( $ep->{isa} and $obj->isa( $ep->{isa} ) )
639 or ( $ep->{does} and $obj->does( $ep->{does} ) ) )
640 {
641 0 ▶ my @args = @{ $ep->{args} || [] };
Condition0%0/2
$ep->{'args'} || []
l!l
00
MC/DC0%0/1
$ep->{'args'} || []
$ep->{'args'}
Truth table0%0/2
A
A= $ep->{'args'}
Aresult
11
00
642 0 ▶ if ( my $callback = $ep->{callback} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $callback = $ep->{'callback'}) { } 0 0 0
elsif ($ep->{'service'} and $ep->{'method'}) { } 0 0 0
643 0 $self->logger->debug(
644 "Invoking callback registered by $ep->{_pkg}");
645 0 $callback->( $obj, @args );
646 }
647 ▶ elsif ( $ep->{service} && $ep->{method} ) {
Condition0%0/3
$ep->{"service"} and $ep->{"method"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ep->{"service"} and $ep->{"method"}
$ep->{"service"} $ep->{"method"}
Truth table0%0/3
A and B
A= $ep->{"service"}B= $ep->{"method"}
ABresult
0X0
100
111
648 0 my $service = $self->getService( $ep->{service} );
649 0 ▶ if ($service) {
Branch: 1 branch
BranchTrueFalseTotal
if ($service) { } 0 0 0
650 0 ▶ if ( my $method = $service->can( $ep->{method} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $method = $service->can($ep->{'method'})) { } 0 0 0
651 0 $self->logger->debug(
652 "Invoking $ep->{method} on $ep->{service}"
653 . " on behalf of $ep->{_pkg}" );
654 0 $service->$method( $obj, @args );
655 }
656 else {
657 0 $self->logger->warn(
658 "Service $ep->{service} has no $ep->{method} method"
659 . " in entrypoint added by $ep->{_pkg}" );
660 }
661 }
662 else {
663 0 $self->logger->warn(
664 "Could not find service $ep->{service}"
665 . " in entrypoint added by $ep->{_pkg}" );
666 }
667 }
668 }
669 }
670  
671 5385 $self->logger->debug("Plugin $module initialized");
672  
673 5385 return $obj;
674 }
675  
676 7035 ▶sub loadModule {
Subroutine loadModule: called CC=9 SCAR=24.1
Pod undocumented
677 7035 my ( $self, $module, $conf, %args ) = @_;
678 7035 ▶ $conf //= $self->conf;
Condition66%2/3
$conf //= $self->conf
l!l&&r!l&&!r
81862170
MC/DC0%0/2
$conf //= $self->conf
$conf $self->conf
Truth table66%2/3
A //= B
A= $confB= $self->conf
ABresult
1X1
011
000
679 7035 my $obj;
680 7035 ▶ $module = "Lemonldap::NG::Portal$module" if ( $module =~ /^::/ );
Branch: 1 branch
BranchTrueFalseTotal
if $module =~ /^::/ 6959 76 7035
681  
682 # If module is not already in namespace, try to load it
683 7035 ▶ unless ( $module->can('new') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($module->can("new")) 2588 4447 7035
684 2588 eval "require $module";
685 2588 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 340 2248 2588
686 340 $self->logger->error("$module load error: $@");
687 340 $self->error("$module load error: $@");
688 340 return 0;
689 }
690 }
691 6695 eval {
692 6695 $obj = $module->new( { p => $self, conf => $conf, %args } );
693 6695 $self->logger->debug("Module $module loaded");
694 };
695 6695 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 6695 6695
696 0 $self->logger->error("Unable to build $module object: $@");
697 0 return 0;
698 }
699 6695 ▶ unless ($obj) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj) 0 6695 6695
700 0 $self->logger->error("$module new() method returned undef");
701 0 return 0;
702 }
703  
704 # Register before init so that plugins loaded during init (e.g. via
705 # _loadConditionalPlugins) can find this module in loadedModules
706 6695 $self->loadedModules->{$module} = $obj;
707  
708 6695 ▶ if ( $obj->can("init") and ( !$obj->init ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->can("init") and not $obj->init) 0 6695 6695
Condition66%2/3
$obj->can("init") and not $obj->init
!ll&&!rl&&r
67560200
MC/DC0%0/2
$obj->can("init") and not $obj->init
$obj->can("init") not $obj->init
Truth table66%2/3
A and not(B)
A= $obj->can("init")B= not $obj->init
ABresult
0X0
100
111
709 0 delete $self->loadedModules->{$module};
710 0 $self->logger->error("$module init failed");
711 0 $self->error("$module init failed");
712 0 return 0;
713 }
714  
715 6695 return $obj;
716 }
717  
718 340 ▶sub fail {
Subroutine fail: called CC=1 SCAR=0.0
Pod undocumented
719 340 $_[0]->logger->error( $_[0]->error );
720 340 $_[0]->addUnauthRoute( '*' => 'displayError' );
721 340 $_[0]->addAuthRoute( '*' => 'displayError' );
722 340 return 0;
723 }
724  
725 2346 ▶sub displayError {
Subroutine displayError: called CC=1 SCAR=0.0
Pod undocumented
726 2346 my ( $self, $req ) = @_;
727 2346 return $self->sendError( $req,
728 'Portal error, contact your administrator', 500 );
729 }
730  
731 # This helper method builds a rule from a string expression
732 # - $rule: rule text
733 # - $ruleDesc optional hint of what the rule is for, to display in error message
734 # returns undef if the rule syntax was invalid
735 3763 ▶sub buildRule {
Subroutine buildRule: called CC=5 SCAR=16.2
Pod undocumented
736 3763 my ( $self, $rule, $ruleDesc ) = @_;
737 3763 ▶ $ruleDesc ||= '';
Condition100%2/2
$ruleDesc ||= ""
l!l
366796
MC/DC100%1/1
$ruleDesc ||= ""
$ruleDesc
Truth table100%2/2
A
A= $ruleDesc
Aresult
11
00
738 3763 my $compiledRule =
739 $self->HANDLER->buildSub( $self->HANDLER->substitute($rule) );
740 3763 ▶ unless ($compiledRule) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($compiledRule) 1 3762 3763
741 my $error =
742 1 ▶ $self->HANDLER->tsv->{jail}->error || 'Unable to compile rule';
Condition50%1/2
$self->HANDLER->tsv->{'jail'}->error || 'Unable to compile rule'
l!l
10
MC/DC0%0/1
$self->HANDLER->tsv->{'jail'}->error || 'Unable to compile rule'
$self->HANDLER->tsv->{'jail'}->error
Truth table50%1/2
A
A= $self->HANDLER->tsv->{'jail'}->error
Aresult
11
00
743 1 $self->logger->error("Bad $ruleDesc rule: $error");
744 1 return undef;
745 }
746  
747 # Avoid deep recursion
748 3762 my $overLoadedRule = $compiledRule;
749 3762 ▶ if ( $self->conf->{logParams} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->conf->{"logParams"}) 6 3756 3762
750 0 ▶ $overLoadedRule = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
751 0 $self->_dump( $_[0] );
752 0 return $compiledRule->(@_);
753 6 };
754 }
755 3762 return $overLoadedRule;
756 }
757  
758 2317 ▶sub addPasswordPolicyDisplay {
Subroutine addPasswordPolicyDisplay: called CC=1 SCAR=0.0
Pod undocumented
759 2317 my ( $self, $id, $options ) = @_;
760 2317 $self->_ppRules->{$id} = {%$options};
761 }
762  
763 2013 ▶sub _addPluginEntryPoint {
Subroutine _addPluginEntryPoint: called CC=1 SCAR=0.0
764 2013 my ( $self, %entryPointDescription ) = @_;
765 2013 push @{ $self->_pluginEntryPoints },
766 { _pkg => "[unknown]", %entryPointDescription };
767 }
768  
769 454 1;
« blib/lib/Lemonldap/NG/Portal/Plugins/Notifications.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/UserDB/Demo.pm »