From 40f16528620535266596fc247109a821031c555d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 27 Sep 2016 12:55:07 +0200 Subject: [PATCH] Auth::ColumnInformation: fetch nur in reset, nicht in init MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit die Version aus e7a7492e macht Probleme im taskserver. ausserdem das reset nur dann machen, wenn es auch sinnvoll ist. Bisher wurde das als silver Bullet aufgerufen, wannimmer sich etwas an der DB geändert haben könnte, also auch beim anlegen der Auth DB in Tests und beim initialen Anlegen. Der erste Fall ist jetzt in eine init Funktion ausgelagert. Im zweiten Fall waren die zu resettenden Werte eh noch nicht gesetzt, und das reset kann rausfallen. --- SL/Auth.pm | 13 ++++++++++++- SL/Auth/ColumnInformation.pm | 2 -- t/000setup_database.t | 3 --- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SL/Auth.pm b/SL/Auth.pm index 0171899c4..5d0b3c871 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -37,11 +37,21 @@ sub new { my $self = bless {}, $type; $self->_read_auth_config(%params); - $self->reset; + $self->init; return $self; } +sub init { + my ($self, %params) = @_; + + $self->{SESSION} = { }; + $self->{FULL_RIGHTS} = { }; + $self->{RIGHTS} = { }; + $self->{unique_counter} = 0; + $self->{column_information} = SL::Auth::ColumnInformation->new(auth => $self); +} + sub reset { my ($self, %params) = @_; @@ -50,6 +60,7 @@ sub reset { $self->{RIGHTS} = { }; $self->{unique_counter} = 0; $self->{column_information} = SL::Auth::ColumnInformation->new(auth => $self); + $self->{column_information}->_fetch; $self->{authenticator}->reset; $self->client(undef); diff --git a/SL/Auth/ColumnInformation.pm b/SL/Auth/ColumnInformation.pm index bf23f6d8d..64b600dd1 100644 --- a/SL/Auth/ColumnInformation.pm +++ b/SL/Auth/ColumnInformation.pm @@ -15,8 +15,6 @@ sub new { $self->{auth} = $params{auth} || croak "Missing 'auth'"; weaken $self->{auth}; - $self->_fetch if $self->{auth}->dbconnect(1); - return $self; } diff --git a/t/000setup_database.t b/t/000setup_database.t index 5cf6a2892..53b5ffe44 100755 --- a/t/000setup_database.t +++ b/t/000setup_database.t @@ -66,7 +66,6 @@ sub drop_and_create_database { SL::DBConnect->get_options, ); - $::auth->reset; my $dbh_template = SL::DBConnect->connect(@dbi_options) || BAIL_OUT("No database connection to the template database: " . $DBI::errstr); my $auth_dbh = $::auth->dbconnect(1); @@ -75,8 +74,6 @@ sub drop_and_create_database { $auth_dbh->disconnect; dbh_do($dbh_template, "DROP DATABASE \"" . $db_cfg->{db} . "\"", message => "Database could not be dropped"); - - $::auth->reset; } dbg("Creating database"); -- 2.20.1