]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Auth::ColumnInformation: fetch nur in reset, nicht in init
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 27 Sep 2016 10:55:07 +0000 (12:55 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 27 Sep 2016 10:58:39 +0000 (12:58 +0200)
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
SL/Auth/ColumnInformation.pm
t/000setup_database.t

index 0171899c4b7c770b64bb29d425592fff140c1593..5d0b3c871a9ed65c3c979a6837702770f76ef5b1 100644 (file)
@@ -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);
index bf23f6d8d144e7976c7593a97cd8b17b4fd81f0a..64b600dd15bc5a5d4b51833ac653caea5270419e 100644 (file)
@@ -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;
 }
 
index 5cf6a28923055cce6a491b9cbfee7dd94072d326..53b5ffe44bc8925bb9af0ebbb9ab72746a0413f5 100755 (executable)
@@ -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");