From: Sven Schöling Date: Fri, 16 Sep 2016 14:50:09 +0000 (+0200) Subject: Auth: session content mit einem sql query holen statt zwei. X-Git-Tag: release-3.5.4~2018 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=81a9ce9b77b4b44edc35f37148cb57bb19fa6cdd;p=kivitendo-erp.git Auth: session content mit einem sql query holen statt zwei. --- diff --git a/SL/Auth.pm b/SL/Auth.pm index f4f096a6c..0171899c4 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -592,47 +592,36 @@ SQL sub _load_with_auto_restore_column { my ($self, $dbh, $session_id) = @_; - my $auto_restore_keys = join ', ', map { "'${_}'" } qw(login password rpw client_id), SESSION_KEY_ROOT_AUTH, SESSION_KEY_USER_AUTH; + my %auto_restore_keys = map { $_ => 1 } qw(login password rpw client_id), SESSION_KEY_ROOT_AUTH, SESSION_KEY_USER_AUTH; my $query = <fetchrow_hashref) { - my $value = SL::Auth::SessionValue->new(auth => $self, - key => $ref->{sess_key}, - value => $ref->{sess_value}, - auto_restore => $ref->{auto_restore}, - raw => 1); - $self->{SESSION}->{ $ref->{sess_key} } = $value; - - next if defined $::form->{$ref->{sess_key}}; - - my $data = $value->get; - $::form->{$ref->{sess_key}} = $data if $value->{auto_restore} || !ref $data; + if ($ref->{auto_restore} || $auto_restore_keys{$ref->{sess_key}}) { + my $value = SL::Auth::SessionValue->new(auth => $self, + key => $ref->{sess_key}, + value => $ref->{sess_value}, + auto_restore => $ref->{auto_restore}, + raw => 1); + $self->{SESSION}->{ $ref->{sess_key} } = $value; + + next if defined $::form->{$ref->{sess_key}}; + + my $data = $value->get; + $::form->{$ref->{sess_key}} = $data if $value->{auto_restore} || !ref $data; + } else { + my $value = SL::Auth::SessionValue->new(auth => $self, + key => $ref->{sess_key}); + $self->{SESSION}->{ $ref->{sess_key} } = $value; + } } $sth->finish; - - $query = <fetchrow_hashref) { - my $value = SL::Auth::SessionValue->new(auth => $self, - key => $ref->{sess_key}); - $self->{SESSION}->{ $ref->{sess_key} } = $value; - } } sub destroy_session {