Use Perl Clone to manage application list (#292)
This commit is contained in:
parent
1c193fa0b5
commit
115ebbe50d
|
@ -15,6 +15,7 @@ build_requires:
|
|||
requires:
|
||||
Apache::Session: 0
|
||||
CGI: 3.08
|
||||
Clone: 0
|
||||
Crypt::OpenSSL::X509: 0
|
||||
File::Basename: 0
|
||||
HTML::Template: 0
|
||||
|
|
|
@ -35,6 +35,7 @@ WriteMakefile(
|
|||
'String::Random' => 0,
|
||||
'XML::LibXML' => 0,
|
||||
'XML::LibXSLT' => 0,
|
||||
'Clone' => 0,
|
||||
},
|
||||
(
|
||||
$] >= 5.005
|
||||
|
|
|
@ -10,8 +10,9 @@ use warnings;
|
|||
use Lemonldap::NG::Portal::Simple;
|
||||
use Lemonldap::NG::Portal::_LibAccess;
|
||||
use base qw(Lemonldap::NG::Portal::_LibAccess);
|
||||
use Clone qw(clone);
|
||||
|
||||
our $VERSION = '1.0.3';
|
||||
our $VERSION = '1.0.5';
|
||||
our $catlevel = 0;
|
||||
|
||||
## @method void menuInit()
|
||||
|
@ -61,6 +62,7 @@ sub menuInit {
|
|||
);
|
||||
|
||||
# Application list for old templates
|
||||
# TODO create an option to activate them, off by default
|
||||
$self->{menuAppslistMenu} = $self->appslistMenu();
|
||||
$self->{menuAppslistDesc} = $self->appslistDescription();
|
||||
|
||||
|
@ -108,7 +110,7 @@ sub appslist {
|
|||
# Reset level
|
||||
$catlevel = 0;
|
||||
|
||||
my $applicationList = $self->{applicationList};
|
||||
my $applicationList = clone( $self->{applicationList} );
|
||||
my $filteredList = $self->_filter($applicationList);
|
||||
push @$appslist, $self->_buildCategoryHash( "", $filteredList, $catlevel );
|
||||
|
||||
|
@ -227,7 +229,7 @@ sub appslistMenu {
|
|||
}
|
||||
|
||||
# Use configuration to get menu parameters
|
||||
my $applicationList = $self->{applicationList};
|
||||
my $applicationList = clone( $self->{applicationList} );
|
||||
my $filteredList = $self->_filter($applicationList);
|
||||
|
||||
return $self->_displayConfCategory( "", $filteredList, $catlevel );
|
||||
|
@ -249,7 +251,7 @@ sub appslistDescription {
|
|||
}
|
||||
|
||||
# Use configuration to get menu parameters
|
||||
my $applicationList = $self->{applicationList};
|
||||
my $applicationList = clone( $self->{applicationList} );
|
||||
return $self->_displayConfDescription( "", $applicationList );
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
# change 'tests => 1' to 'tests => last_test_to_print';
|
||||
|
||||
use Test::More tests => 8;
|
||||
use Test::More tests => 9;
|
||||
BEGIN { use_ok('Lemonldap::NG::Portal::Menu') }
|
||||
|
||||
#########################
|
||||
|
@ -127,3 +127,18 @@ ok( $displayOff == 0, 'Display off' );
|
|||
ok( $displayOk != 0, 'Display auto ok' );
|
||||
ok( $displayNok == 0, 'Display auto nok' );
|
||||
|
||||
# Connect as another user with different rights
|
||||
$p->{sessionInfo}->{uid} = "toto";
|
||||
my $appLoop2 = $p->appslist();
|
||||
my $displayOk2 = 0;
|
||||
|
||||
foreach (@$appLoop2) {
|
||||
if ( $_->{catid} eq "test" ) {
|
||||
foreach ( @{ $_->{'applications'} } ) {
|
||||
$displayOk2++ if $_->{appid} eq "testautonok";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok( $displayOk2 != 0, 'Display auto ok for different user' );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user