X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMenu.pm;h=044ce9b798ea3a3a05f4a31d05b7821f8079f8ba;hb=98e5f0698f9419d600ee8652620217d17a3392f2;hp=0bdf945e4a888690a45dece9f0e684755849b06e;hpb=e848dbf1f17a606e22afb161cb3fb7bd88895f92;p=kivitendo-erp.git diff --git a/SL/Menu.pm b/SL/Menu.pm index 0bdf945e4..044ce9b79 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -69,7 +69,7 @@ sub menuitem { my $level = $form->escape($item); my $str = - qq|{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|; + qq|{login}&password=$form->{password}|; my @vars = qw(module action target href); @@ -83,7 +83,7 @@ sub menuitem { # add other params foreach my $key (keys %{ $self->{$item} }) { $str .= "&" . $form->escape($key, 1) . "="; - ($value, $conf) = split /=/, $self->{$item}{$key}, 2; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); $value = $myconfig->{$value} . "/$conf" if ($conf); $str .= $form->escape($value, 1); } @@ -99,6 +99,67 @@ sub menuitem { return $str; } +sub menuitem_v3 { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form, $item, $other) = @_; + + my $module = $form->{script}; + my $action = "section_menu"; + my $target = ""; + + if ($self->{$item}{module}) { + $module = $self->{$item}{module}; + } + if ($self->{$item}{action}) { + $action = $self->{$item}{action}; + } + if ($self->{$item}{target}) { + $target = $self->{$item}{target}; + } + + my $level = $form->escape($item); + + my $str = qq|escape($key, 1) . "="; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); + $value = $myconfig->{$value} . "/$conf" if ($conf); + $str .= $form->escape($value, 1); + } + + $str .= '"'; + + if ($target) { + $str .= qq| target="| . $form->quote($target) . qq|"|; + } + + if ($other) { + foreach my $key (keys(%{$other})) { + $str .= qq| ${key}="| . $form->quote($other->{$key}) . qq|"|; + } + } + + $str .= ">"; + + $main::lxdebug->leave_sub(); + + return $str; +} + sub menuitemNew { my ($self, $myconfig, $form, $item) = @_; @@ -115,7 +176,7 @@ sub menuitemNew { my $level = $form->escape($item); my $str = - qq|$module?path=$form->{path}&action=$action&level=$level&login=$form->{login}&password=$form->{password}|; + qq|$module?action=$action&level=$level&login=$form->{login}&password=$form->{password}|; my @vars = qw(module action target href); if ($self->{$item}{href}) { @@ -128,7 +189,7 @@ sub menuitemNew { # add other params foreach my $key (keys %{ $self->{$item} }) { $str .= "&" . $form->escape($key, 1) . "="; - ($value, $conf) = split /=/, $self->{$item}{$key}, 2; + ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); $value = $myconfig->{$value} . "/$conf" if ($conf); $str .= $form->escape($value, 1); } @@ -138,7 +199,7 @@ sub menuitemNew { } sub access_control { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(2); my ($self, $myconfig, $menulevel) = @_; @@ -150,21 +211,34 @@ sub access_control { @menu = grep { /^${menulevel}--/ } @{ $self->{ORDER} }; } - my @a = split /;/, $myconfig->{acs}; + my @a = split(/;/, $myconfig->{acs}); my $excl = (); # remove --AR, --AP from array - grep { ($a, $b) = split /--/; s/--$a$//; } @a; + grep { ($a, $b) = split(/--/); s/--$a$//; } @a; map { $excl{$_} = 1 } @a; @a = (); map { push @a, $_ unless $excl{$_} } (@menu); - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(2); return @a; } +sub generate_acl { + my ($self, $menulevel, $hash) = @_; + + my @items = $self->access_control(\%main::myconfig, $menulevel); + + $menulevel =~ s/[^A-Za-z_\/\.\+\-]/_/g; + $hash->{"access_" . lc($menulevel)} = 1 if ($menulevel); + + foreach my $item (@items) { + $self->generate_acl($item, $hash); #unless ($menulevel); + } +} + 1;