Revision 9e428908
Von Sven Schöling vor mehr als 13 Jahren hinzugefügt
SL/Auth.pm | ||
---|---|---|
1128 | 1128 |
} |
1129 | 1129 |
|
1130 | 1130 |
sub load_rights_for_user { |
1131 |
$main::lxdebug->enter_sub(); |
|
1132 |
|
|
1133 |
my $self = shift; |
|
1134 |
my $login = shift; |
|
1135 |
|
|
1136 |
my $form = $main::form; |
|
1137 |
my $dbh = $self->dbconnect(); |
|
1131 |
$::lxdebug->enter_sub; |
|
1138 | 1132 |
|
1133 |
my ($self, $login) = @_; |
|
1134 |
my $dbh = $self->dbconnect; |
|
1139 | 1135 |
my ($query, $sth, $row, $rights); |
1140 | 1136 |
|
1141 |
$rights = {}; |
|
1137 |
$rights = { map { $rights->{$_} = 0 } all_rights() };
|
|
1142 | 1138 |
|
1143 | 1139 |
$query = |
1144 | 1140 |
qq|SELECT gr."right", gr.granted |
... | ... | |
1149 | 1145 |
LEFT JOIN auth."user" u ON (ug.user_id = u.id) |
1150 | 1146 |
WHERE u.login = ?)|; |
1151 | 1147 |
|
1152 |
$sth = prepare_execute_query($form, $dbh, $query, $login); |
|
1148 |
$sth = prepare_execute_query($::form, $dbh, $query, $login);
|
|
1153 | 1149 |
|
1154 | 1150 |
while ($row = $sth->fetchrow_hashref()) { |
1155 | 1151 |
$rights->{$row->{right}} |= $row->{granted}; |
1156 | 1152 |
} |
1157 | 1153 |
$sth->finish(); |
1158 | 1154 |
|
1159 |
map({ $rights->{$_} = 0 unless (defined $rights->{$_}); } SL::Auth::all_rights()); |
|
1160 |
|
|
1161 |
$main::lxdebug->leave_sub(); |
|
1155 |
$::lxdebug->leave_sub; |
|
1162 | 1156 |
|
1163 | 1157 |
return $rights; |
1164 | 1158 |
} |
Auch abrufbar als: Unified diff
Auth::load_group_rights - etwas aufgeräumt.