From f6665c2d41fd64abb8e2697b8061ca0a20693407 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Mon, 30 Jan 2017 21:35:37 +0000 Subject: [PATCH] Bad usage of getModule (#595) --- .../lib/Lemonldap/NG/Portal/Password/Demo.pm | 8 +------- .../lib/Lemonldap/NG/Portal/UserDB/Demo.pm | 6 ------ .../lib/Lemonldap/NG/Portal/UserDB/Facebook.pm | 7 ------- .../lib/Lemonldap/NG/Portal/UserDB/OpenID.pm | 6 ------ .../lib/Lemonldap/NG/Portal/UserDB/SAML.pm | 5 ----- .../lib/Lemonldap/NG/Portal/UserDB/WebID.pm | 7 ------- 6 files changed, 1 insertion(+), 38 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Demo.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Demo.pm index 77b65c7db..3a0132e29 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Demo.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Demo.pm @@ -10,13 +10,7 @@ our $VERSION = '2.0.0'; sub init { my ($self) = @_; - if ( $self->p->getModule( undef, 'auth' ) eq 'Demo' ) { - return $self->SUPER::init; - } - else { - $self->lmLog( "Use PasswordDBDemo only with AuthDemo", 'error' ); - return 0; - } + return $self->SUPER::init; } sub confirm { diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm index 5a5450776..04f24cfcb 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm @@ -41,12 +41,6 @@ has demoAccounts => ( # Check AuthDemo use sub init { - my $self = shift; - - unless ( $self->p->getModule( undef, 'auth' ) =~ /Demo/ ) { - $self->p->error("Use UserDB::Demo only with Auth::Demo"); - } - 1; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Facebook.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Facebook.pm index a8ce3885f..72133fbcd 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Facebook.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Facebook.pm @@ -21,13 +21,6 @@ has vars => ( # INITIALIZATION sub init { - my ($self) = @_; - unless ( $self->p->getModule( undef, 'auth' ) =~ /^Facebook/ ) { - $self->error( -"UserDB::Facebook isn't useable unless authentication module is set to Facebook" - ); - return 0; - } return 1; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/OpenID.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/OpenID.pm index f35076617..d016bdbba 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/OpenID.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/OpenID.pm @@ -16,12 +16,6 @@ extends 'Lemonldap::NG::Common::Module', sub init { my ($self) = @_; - unless ( $self->p->getModule( undef, 'auth' ) =~ /^OpenID\b/ ) { - $self->error( -'UserDBOpenID isn\'t useable unless authentication module is set to OpenID' - ); - return 0; - } return 1; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/SAML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/SAML.pm index 38d70b474..381e33394 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/SAML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/SAML.pm @@ -19,11 +19,6 @@ extends 'Lemonldap::NG::Common::Module', 'Lemonldap::NG::Portal::Lib::SAML'; sub init { my ($self) = @_; - unless ( $self->p->getModule( undef, 'auth' ) =~ /^SAML/ ) { - $self->error( "SAML user module requires SAML authentication" ); - return 0; - } - # SAML service has been already loaded $self->lassoServer( $self->p->loadedModules->{'Lemonldap::NG::Portal::Auth::SAML'} diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/WebID.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/WebID.pm index f2651a0f2..13bca77c5 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/WebID.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/WebID.pm @@ -15,13 +15,6 @@ our $VERSION = '2.0.0'; # INITIALIZATION sub init { - my $self = shift; - unless ( $self->p->getModule( undef, 'auth' ) =~ /^WebID/ ) { - $self->error( -"UserDB::WebID isn't useable unless authentication module is set to WebID" - ); - return 0; - } 1; }