From: Sven Schöling Date: Fri, 13 May 2011 08:40:17 +0000 (+0200) Subject: Auth::load_group_rights - etwas aufgeräumt. X-Git-Tag: release-2.6.3~25^2~37^2~13 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9e4289087585b2e1688992e79c2ea4c76f1db1b1;p=kivitendo-erp.git Auth::load_group_rights - etwas aufgeräumt. --- diff --git a/SL/Auth.pm b/SL/Auth.pm index 3b14def5d..67c8eed71 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -1128,17 +1128,13 @@ sub assert { } sub load_rights_for_user { - $main::lxdebug->enter_sub(); - - my $self = shift; - my $login = shift; - - my $form = $main::form; - my $dbh = $self->dbconnect(); + $::lxdebug->enter_sub; + my ($self, $login) = @_; + my $dbh = $self->dbconnect; my ($query, $sth, $row, $rights); - $rights = {}; + $rights = { map { $rights->{$_} = 0 } all_rights() }; $query = qq|SELECT gr."right", gr.granted @@ -1149,16 +1145,14 @@ sub load_rights_for_user { LEFT JOIN auth."user" u ON (ug.user_id = u.id) WHERE u.login = ?)|; - $sth = prepare_execute_query($form, $dbh, $query, $login); + $sth = prepare_execute_query($::form, $dbh, $query, $login); while ($row = $sth->fetchrow_hashref()) { $rights->{$row->{right}} |= $row->{granted}; } $sth->finish(); - map({ $rights->{$_} = 0 unless (defined $rights->{$_}); } SL::Auth::all_rights()); - - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; return $rights; }