From 9e4289087585b2e1688992e79c2ea4c76f1db1b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 13 May 2011 10:40:17 +0200 Subject: [PATCH] =?utf8?q?Auth::load=5Fgroup=5Frights=20-=20etwas=20aufger?= =?utf8?q?=C3=A4umt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Auth.pm | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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; } -- 2.20.1