From a8dfefe4ed39f8acbc1fe68697bfa6fd56b62cf4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 3 Feb 2018 15:38:59 -0600 Subject: [PATCH] Feature: add 'database_user_public_default' option to not use public/anonymous account access to the database 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/standard/classes/standard_index.php b/common/standard/classes/standard_index.php index 3d037f1..0828405 100644 --- a/common/standard/classes/standard_index.php +++ b/common/standard/classes/standard_index.php @@ -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) { -- 1.8.3.1