]> Kevux Git Server - koopa/commitdiff
Feature: add 'database_user_public_default' option to not use public/anonymous accoun...
authorKevin Day <thekevinday@gmail.com>
Sat, 3 Feb 2018 21:38:59 +0000 (15:38 -0600)
committerKevin Day <thekevinday@gmail.com>
Sat, 3 Feb 2018 21:38:59 +0000 (15:38 -0600)
This allows for database-less connections by default.
Some sites may use this, but the primary design of the project focuses on public/anonymous database access.
More work may be necessary.

common/standard/classes/standard_index.php

index 3d037f1c35e09c57421ecea5943bc6a157707d09..082840592365a60d93c45ad09da26a036a8c2070 100644 (file)
@@ -61,6 +61,7 @@ class c_standard_index extends c_base_return {
     $this->settings['database_port']                = 5432;
     $this->settings['database_name']                = NULL;
     $this->settings['database_user_public']         = NULL;
+    $this->settings['database_user_public_default'] = TRUE; // when TRUE, auto-login as public account by default, when FALSE do not attempt anonymous database connection.
     $this->settings['database_timeout']             = 4;
     $this->settings['database_ssl_mode']            = 'disable';
     $this->settings['database_create_account_host'] = '127.0.0.1';
@@ -504,6 +505,11 @@ class c_standard_index extends c_base_return {
     else {
       $user_name = $this->settings['database_user_public'];
       $password = NULL;
+
+      // do not login with public/anoynmous account if default is disabled.
+      if (!$this->settings['database_user_public_default']) {
+        return new c_base_return_false();
+      }
     }
 
     if (!is_string($user_name) || strlen($user_name) < 0) {