68 lines
1.9 KiB
Perl
68 lines
1.9 KiB
Perl
# 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';
|
|
|
|
package Lemonldap::NG::Portal::Main;
|
|
|
|
use strict;
|
|
|
|
##@method list enabledPlugins
|
|
#
|
|
#@return list of enabled plugins
|
|
sub enabledPlugins {
|
|
my ($self) = @_;
|
|
my @res;
|
|
|
|
# Search for IssuerDB* modules enabled
|
|
foreach my $key (qw(SAML OpenID CAS OpenIDConnect)) {
|
|
if ( $self->conf->{"issuerDB${key}Activation"} ) {
|
|
$self->lmlog( "IssuerDB${key} enabled", 'debug' );
|
|
push @res, "::IssuerDB::$key";
|
|
}
|
|
}
|
|
|
|
# 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;
|
|
# }
|
|
#}
|
|
|
|
# Check if SOAP is enabled
|
|
# TODO: REST
|
|
push @res, 'SOAP' if ( $self->conf->{Soap} );
|
|
|
|
# Check if notification is enabled
|
|
push @res, '::Plugins::Notifications' if ( $self->conf->{notifications} );
|
|
foreach my $type (qw(password register)) {
|
|
my $tmp = $self->conf->{$type};
|
|
if ( $tmp and $tmp ne 'Null' ) {
|
|
$tmp = '::' . ucfirst($type) . "DB::$tmp";
|
|
$self->lmLog("$tmp enabled");
|
|
push @res, $tmp;
|
|
}
|
|
}
|
|
|
|
# Simple plugins
|
|
push @res, '::Plugins::GrantSession' if ( $self->conf->{grantSessionRule} );
|
|
push @res, '::Plugins::CDA' if ( $self->conf->{cda} );
|
|
|
|
# TODO: Password
|
|
|
|
# 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} ) );
|
|
}
|
|
return @res;
|
|
}
|
|
|
|
1;
|