New custom parameter (customMenuTabs) to allow display of custom tab (#1596)

This commit is contained in:
Clément OUDOT 2018-12-17 18:27:31 +01:00
parent a3c982f470
commit 5aad03fdb9

View File

@ -60,6 +60,8 @@ sub params {
my ( $self, $req ) = @_; my ( $self, $req ) = @_;
$self->{conf}->{imgPath} ||= $self->{staticPrefix}; $self->{conf}->{imgPath} ||= $self->{staticPrefix};
my %res; my %res;
my @defaultTabs = (qw/appslist password logout loginHistory oidcConsents/);
my @customTabs = split( /,\s*/, $self->{conf}->{customMenuTabs} );
# Tab to display # Tab to display
# Get the tab URL parameter # Get the tab URL parameter
@ -90,11 +92,18 @@ sub params {
# else calculate modules to display # else calculate modules to display
else { else {
$res{DISPLAY_TAB} = ( my $tab = $req->param("tab");
grep /^(password|logout|loginHistory|oidcConsents)$/, if ( defined $tab
$req->param("tab") // '' and grep ( /^$tab$/, ( @defaultTabs, @customTabs ) ) )
)[0] {
|| "applist"; $self->logger->debug( "Select menu tab "
. $req->param("tab")
. "from GET parameter" );
$res{DISPLAY_TAB} = $req->param("tab");
}
else {
$res{DISPLAY_TAB} = "appslist";
}
} }
$res{DISPLAY_MODULES} = $self->displayModules($req); $res{DISPLAY_MODULES} = $self->displayModules($req);