projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
task_server: pro Job mit Sprache vom konfiguriert initialisieren
[kivitendo-erp.git]
/
SL
/
Menu.pm
diff --git
a/SL/Menu.pm
b/SL/Menu.pm
index
57d8b4e
..
19b2d2d
100644
(file)
--- a/
SL/Menu.pm
+++ b/
SL/Menu.pm
@@
-42,14
+42,19
@@
use strict;
sub new {
$main::lxdebug->enter_sub();
sub new {
$main::lxdebug->enter_sub();
- my ($type, $menufile) = @_;
+ my ($type, @menufiles) = @_;
+ my $self = bless {}, $type;
- my $self = {};
- my $inifile = Inifile->new($menufile);
+ my @order;
- map { $self->{$_} = $inifile->{$_} } keys %{ $inifile };
+ foreach my $menufile (grep { -f } @menufiles) {
+ my $inifile = Inifile->new($menufile);
- bless $self, $type;
+ push @order, @{ delete($inifile->{ORDER}) || [] };
+ $self->{$_} = $inifile->{$_} for keys %{ $inifile };
+ }
+
+ $self->{ORDER} = \@order;
$self->set_access();
$self->set_access();
@@
-94,7
+99,7
@@
sub access_control {
my @menu = ();
my @menu = ();
- if (
$menulevel eq ""
) {
+ if (
!$menulevel
) {
@menu = grep { !/--/ } @{ $self->{ORDER} };
} else {
@menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
@menu = grep { !/--/ } @{ $self->{ORDER} };
} else {
@menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} };
@@
-157,6
+162,11
@@
sub parse_access_string {
return SL::Auth::evaluate_rights_ary($stack[0]);
}
return SL::Auth::evaluate_rights_ary($stack[0]);
}
+sub parse_instance_conf_string {
+ my ($self, $setting) = @_;
+ return $::instance_conf->data->{$setting};
+}
+
sub set_access {
my $self = shift;
sub set_access {
my $self = shift;
@@
-166,6
+176,7
@@
sub set_access {
my $entry = $self->{$key};
$entry->{GRANTED} = $entry->{ACCESS} ? $self->parse_access_string($key, $entry->{ACCESS}) : 1;
my $entry = $self->{$key};
$entry->{GRANTED} = $entry->{ACCESS} ? $self->parse_access_string($key, $entry->{ACCESS}) : 1;
+ $entry->{GRANTED} &&= $self->parse_instance_conf_string($entry->{INSTANCE_CONF}) if $entry->{INSTANCE_CONF};
$entry->{IS_MENU} = $entry->{submenu} || ($key !~ m/--/);
$entry->{NUM_VISIBLE_CHILDREN} = 0;
$entry->{IS_MENU} = $entry->{submenu} || ($key !~ m/--/);
$entry->{NUM_VISIBLE_CHILDREN} = 0;