2016-03-29 23:09:55 +02:00
|
|
|
# This module loads known enabled plugins. To add custom modules, just add them
|
|
|
|
# into "plugins" list in lemonldap-ng.ini, section "portal"
|
|
|
|
package Lemonldap::NG::Portal::Main::Plugins;
|
|
|
|
|
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
2016-04-07 23:31:56 +02:00
|
|
|
package Lemonldap::NG::Portal::Main;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2016-03-29 23:09:55 +02:00
|
|
|
##@method list enabledPlugins
|
|
|
|
#
|
|
|
|
#@return list of enabled plugins
|
|
|
|
sub enabledPlugins {
|
|
|
|
my ($self) = @_;
|
|
|
|
my @res;
|
|
|
|
|
2016-06-12 18:52:37 +02:00
|
|
|
# Search for Issuer* modules enabled
|
2016-06-10 13:03:13 +02:00
|
|
|
foreach my $key (qw(SAML OpenID CAS OpenIDConnect Get)) {
|
2016-03-29 23:09:55 +02:00
|
|
|
if ( $self->conf->{"issuerDB${key}Activation"} ) {
|
2016-06-12 21:26:14 +02:00
|
|
|
$self->lmLog( "Issuer${key} enabled", 'debug' );
|
2016-06-12 18:52:37 +02:00
|
|
|
push @res, "::Issuer::$key";
|
2016-03-29 23:09:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-29 09:27:26 +02:00
|
|
|
# Check if captcha is required
|
|
|
|
# TODO: verify if this list is OK
|
|
|
|
#foreach my $key (
|
|
|
|
# qw(captcha_login_enabled captcha_mail_enabled captcha_register_enabled))
|
|
|
|
#{
|
|
|
|
# if ( $self->conf->{$key} ) {
|
|
|
|
# $self->lmLog( 'Captcha enabled', 'debug' );
|
|
|
|
# push @res, '::Plugins::Captcha';
|
|
|
|
# last;
|
|
|
|
# }
|
|
|
|
#}
|
2016-03-29 23:09:55 +02:00
|
|
|
|
|
|
|
# Check if SOAP is enabled
|
|
|
|
# TODO: REST
|
|
|
|
push @res, 'SOAP' if ( $self->conf->{Soap} );
|
|
|
|
|
|
|
|
# Check if notification is enabled
|
2016-04-03 18:51:23 +02:00
|
|
|
push @res, '::Plugins::Notifications' if ( $self->conf->{notifications} );
|
2016-03-29 23:09:55 +02:00
|
|
|
foreach my $type (qw(password register)) {
|
|
|
|
my $tmp = $self->conf->{$type};
|
|
|
|
if ( $tmp and $tmp ne 'Null' ) {
|
2016-04-03 08:33:50 +02:00
|
|
|
$tmp = '::' . ucfirst($type) . "DB::$tmp";
|
2016-03-29 23:09:55 +02:00
|
|
|
$self->lmLog("$tmp enabled");
|
|
|
|
push @res, $tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-03 10:44:58 +02:00
|
|
|
# Simple plugins
|
2016-07-07 23:55:23 +02:00
|
|
|
# TODO: write these plugins
|
2016-04-01 12:46:12 +02:00
|
|
|
push @res, '::Plugins::GrantSession' if ( $self->conf->{grantSessionRule} );
|
2016-04-03 10:44:58 +02:00
|
|
|
push @res, '::Plugins::CDA' if ( $self->conf->{cda} );
|
2016-07-14 10:25:05 +02:00
|
|
|
push @res, '::Plugins::ForceAuth' if ( $self->conf->{portalForceAuthn} );
|
2016-04-01 12:10:42 +02:00
|
|
|
|
2016-07-07 23:55:23 +02:00
|
|
|
if ( my $p = $self->conf->{passwordDB} ) {
|
|
|
|
push @res, "::Password::$p" if ( $p ne 'Null' );
|
|
|
|
}
|
2016-03-31 22:08:43 +02:00
|
|
|
|
2016-03-29 23:09:55 +02:00
|
|
|
# Check if custom plugins are required
|
|
|
|
if ( $self->conf->{plugins} ) {
|
|
|
|
$self->lmLog( 'Custom plugins: ' . $self->conf->{plugins}, 'debug' );
|
|
|
|
push @res, grep ( /\w/, split( /,\s*/, $self->conf->{plugins} ) );
|
|
|
|
}
|
2016-04-03 18:51:23 +02:00
|
|
|
return @res;
|
2016-03-29 23:09:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|