From: Moritz Bunkus Date: Thu, 6 Jun 2013 11:21:47 +0000 (+0200) Subject: SL::Auth: Client-Properties aus Auth-DB lesen und in $::auth->client speichern können X-Git-Tag: release-3.1.0beta1~331^2~61 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3e29b95e9880aad25d13f4f410fda4ee1f1c5e9d;p=kivitendo-erp.git SL::Auth: Client-Properties aus Auth-DB lesen und in $::auth->client speichern können --- diff --git a/SL/Auth.pm b/SL/Auth.pm index 420724b4c..453354d4d 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -26,6 +26,11 @@ use strict; use constant SESSION_KEY_ROOT_AUTH => 'session_auth_status_root'; use constant SESSION_KEY_USER_AUTH => 'session_auth_status_user'; +use Rose::Object::MakeMethods::Generic ( + scalar => [ qw(client) ], +); + + sub new { $main::lxdebug->enter_sub(); @@ -51,6 +56,23 @@ sub reset { $self->{unique_counter} = 0; $self->{column_information} = SL::Auth::ColumnInformation->new(auth => $self); $self->{authenticator}->reset; + + $self->client(undef); +} + +sub set_client { + my ($self, $id_or_name) = @_; + + $self->client(undef); + + my $column = $id_or_name =~ m/^\d+$/ ? 'id' : 'name'; + my $dbh = $self->dbconnect; + + return undef unless $dbh; + + $self->client($dbh->selectrow_hashref(qq|SELECT * FROM auth.clients WHERE ${column} = ?|, undef, $id_or_name)); + + return $self->client; } sub get_user_dbh {