Skeleton for partner rules in Menu #1330

TODO: JS part
environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent 7f0ff6d0d8
commit 7f1ba1f3c4
  1. 4
      fastcgi-server/man/llng-fastcgi-server.1p
  2. 14
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm
  3. 15
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm

@ -129,7 +129,7 @@
.\" ========================================================================
.\"
.IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2017-10-26" "perl v5.26.0" "User Contributed Perl Documentation"
.TH llng-fastcgi-server 1 "2017-11-11" "perl v5.26.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -185,7 +185,7 @@ Each parameter can be set by an option or a environment variable.
.SH "BUG REPORT"
.IX Header "BUG REPORT"
Use \s-1OW2\s0 system to report bug or ask for features:
<http://jira.ow2.org>
<https://gitlab.ow2.org/lemonldap\-ng/lemonldap\-ng/issues>
.SH "DOWNLOAD"
.IX Header "DOWNLOAD"
Lemonldap::NG is available at

@ -288,6 +288,7 @@ sub reloadConf {
1;
}
# Method used to load plugins
sub loadPlugin {
my ( $self, $plugin ) = @_;
my $obj;
@ -296,8 +297,11 @@ sub loadPlugin {
return $self->findEP( $plugin, $obj );
}
# Insert declared entry points into corresponding arrays
sub findEP {
my ( $self, $plugin, $obj ) = @_;
# Standards entry points
foreach my $sub (
qw(beforeAuth betweenAuthAndDatas afterDatas forAuthUser beforeLogout))
{
@ -309,6 +313,16 @@ sub findEP {
}
}
}
# Rules for menu
if ( $obj->can('spRules') ) {
foreach my $k ( keys %{ $obj->{spRules} } ) {
$self->logger->info(
"$k is defined more than one time, it can have some bad effect on Menu display"
) if ( $self->spRules->{$k} );
$self->spRules->{$k} = $obj->{spRules}->{$k};
}
}
( $obj and $obj->init ) or return 0;
$self->logger->debug("Plugin $plugin initializated");
return $obj;

@ -422,6 +422,21 @@ sub _filterHash {
my $cond = undef;
# Handle partner rules (SAML, CAS or OIDC)
if ( $appdisplay =~ /^partner:\s*(.*)$/ ) {
my $p = $1;
if ( my $sub = $self->spRules->{$p} ) {
eval {
delete $apphash->{$key}
unless ( $p->( $req, $req->sessionInfo ) );
};
if ($@) {
$self->logger->error("Partner rule $p returns: $@");
}
}
next;
}
# If a specific rule exists, get it from cache or compile it
if ( $appdisplay !~ /^auto$/i ) {
if ( $self->specific->{$appuri} ) {

Loading…
Cancel
Save