Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maxime Besson
lemonldap-ng
Commits
8307161f
Commit
8307161f
authored
Jul 02, 2016
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on Choice (#595)
parent
1577400b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
16 deletions
+22
-16
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Choice.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Choice.pm
+4
-4
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm
+12
-5
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
+1
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
+2
-2
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
+1
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
+2
-2
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm
+0
-1
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Choice.pm
View file @
8307161f
...
...
@@ -2,7 +2,7 @@ package Lemonldap::NG::Portal::Auth::Choice;
use
strict
;
use
Mouse
;
use
Lemonldap::NG::Portal::Main::
Constants
qw(PE_FIRSTACCESS)
;
use
Lemonldap::NG::Portal::Main::
Constants
qw(
PE_OK
PE_FIRSTACCESS)
;
extends
'
Lemonldap::NG::Portal::Lib::Choice
';
...
...
@@ -21,17 +21,17 @@ sub authenticate {
}
sub
authForce
{
$_
[
0
]
->
checkChoice
(
$_
[
1
]
);
$_
[
0
]
->
checkChoice
(
$_
[
1
]
)
or
return
PE_OK
;
return
$_
[
1
]
->
datas
->
{
enabledMods
}
->
[
0
]
->
authForce
(
$_
[
1
]
);
}
sub
authLogout
{
$_
[
0
]
->
checkChoice
(
$_
[
1
]
);
$_
[
0
]
->
checkChoice
(
$_
[
1
]
)
or
return
PE_OK
;
return
$_
[
1
]
->
datas
->
{
enabledMods
}
->
[
0
]
->
authLogout
(
$_
[
1
]
);
}
sub
getDisplayType
{
$_
[
0
]
->
checkChoice
(
$_
[
1
]
);
$_
[
0
]
->
checkChoice
(
$_
[
1
]
)
or
return
PE_OK
;
return
$_
[
1
]
->
datas
->
{
enabledMods
}
->
[
0
]
->
getDisplayType
(
$_
[
1
]
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm
View file @
8307161f
...
...
@@ -34,17 +34,21 @@ sub init {
);
}
else
{
# error() is set by underlying module
return
0
;
$self
->
lmLog
("
Choice: unable to load
$name
, disabling it:
"
.
$self
->
error
,'
error
');
$self
->
error
('');
}
}
unless
(
keys
%
{
$self
->
modules
})
{
$self
->
error
('
Choice: no available modules found, aborting
');
return
0
;
}
return
1
;
}
sub
checkChoice
{
my
(
$self
,
$req
)
=
@_
;
return
$req
->
sessionInfo
->
{
_choice
}
if
(
$req
->
sessionInfo
->
{
_choice
}
)
;
my
$name
=
$req
->
param
(
$self
->
conf
->
{
authChoiceParam
}
)
or
return
0
;
my
$name
=
$req
->
sessionInfo
->
{
_choice
}
||
$req
->
param
(
$self
->
conf
->
{
authChoiceParam
}
)
or
return
0
;
return
$name
if
(
$req
->
datas
->
{
enabledMods
}
)
;
unless
(
defined
$self
->
modules
->
{
$name
}
)
{
$self
->
lmLog
(
"
Unknown choice '
$name
'
",
'
error
'
);
return
0
;
...
...
@@ -52,11 +56,14 @@ sub checkChoice {
$req
->
sessionInfo
->
{
_choice
}
=
$name
;
$req
->
datas
->
{
enabledMods
}
=
[
$self
->
modules
->
{
$name
}
];
$self
->
p
->
_authentication
->
authnLevel
("
${name}
AuthnLevel
");
return
1
;
return
$name
;
}
sub
name
{
my
(
$self
,
$req
,
$type
)
=
@_
;
unless
(
$req
)
{
return
'
Choice
';
}
my
$n
=
ref
(
$req
->
datas
->
{
enableMods
}
->
[
0
]
);
$n
=~
s/^Lemonldap::NG::Portal::(?:(?:UserDB|Auth)::)?//
;
return
$n
;
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
View file @
8307161f
...
...
@@ -268,7 +268,7 @@ sub display {
# Choose what form to display if not in a loop
else
{
my
$displayType
=
$self
->
_authentication
->
getDisplayType
();
my
$displayType
=
$self
->
_authentication
->
getDisplayType
(
$req
);
$self
->
lmLog
(
"
Display type
$displayType
",
'
debug
'
);
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
View file @
8307161f
...
...
@@ -120,7 +120,7 @@ sub checkLogout {
sub
authLogout
{
my
(
$self
,
$req
)
=
@_
;
return
$self
->
_authentication
->
authLogout
(
@
_
);
return
$self
->
_authentication
->
authLogout
(
$req
);
}
sub
deleteSession
{
...
...
@@ -432,7 +432,7 @@ sub cookie {
}
sub
_dump
{
my
(
$self
,
$variable
)
=
@_
;
my
(
$self
,
$variable
)
=
@_
;
require
Data::
Dumper
;
$
Data::Dumper::
Indent
=
0
;
$self
->
lmLog
(
"
Dump:
"
.
Data::Dumper::
Dumper
(
$variable
),
'
debug
'
);
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
View file @
8307161f
...
...
@@ -105,7 +105,7 @@ sub error_type {
sub
init
{
my
(
$self
)
=
@_
;
$self
->
{
$_
}
=
{}
foreach
(
qw(datas customParameters)
);;
$self
->
{
$_
}
=
{}
foreach
(
qw(datas customParameters
sessionInfo
)
);;
$self
->
{
$_
}
=
[]
foreach
(
qw(respCookies)
);;
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
View file @
8307161f
...
...
@@ -164,8 +164,8 @@ sub getModule {
}
->
{
$type
}
)
{
if
(
$self
->
$mod
->
can
('
name
')
)
{
return
$s
elf
->
$mod
->
can
('
name
')
->
(
$self
->
mod
,
$req
,
$type
);
if
(
my
$sub
=
$self
->
$mod
->
can
('
name
')
)
{
return
$s
ub
->
(
$self
->
$
mod
,
$req
,
$type
);
}
else
{
my
$s
=
ref
(
$self
->
$mod
);
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm
View file @
8307161f
...
...
@@ -21,7 +21,6 @@ sub init {
unless
(
$self
->
p
->
getModule
(
undef
,
'
auth
'
)
=~
/Demo/
)
{
$self
->
p
->
error
("
Use UserDB::Demo only with Auth::Demo
");
return
0
;
}
# Sample accounts from Doctor Who characters
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment