From b80c588a104503ee388a839676f5826882a53ee8 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 28 Jul 2019 11:02:44 +0200 Subject: [PATCH] fixing database schema for message removal Signed-off-by: Janos SUTO --- util/db-mysql.sql | 7 +++++-- webui/controller/audit/removal.php | 2 +- webui/controller/message/bulkremove.php | 2 +- webui/model/search/search.php | 4 ++-- webui/view/theme/default/templates/common/layout-audit.tpl | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/util/db-mysql.sql b/util/db-mysql.sql index 58b01f62..55305752 100644 --- a/util/db-mysql.sql +++ b/util/db-mysql.sql @@ -473,10 +473,13 @@ create table if not exists `timestamp` ( create table if not exists `deleted` ( `id` bigint unsigned not null unique, - `email` varchar(128) not null, - `reason` varchar(128) not null, + `requestor` varchar(128) not null, + `reason1` varchar(128) not null, `date1` int unsigned default 0, + `approver` varchar(128) default null, + `reason2` varchar(128) not null, `date2` int unsigned default 0, + `approved` tinyint(1) default 0, `deleted` tinyint(1) default 0, key (`id`), key (deleted) diff --git a/webui/controller/audit/removal.php b/webui/controller/audit/removal.php index 8fd79734..61383b4e 100644 --- a/webui/controller/audit/removal.php +++ b/webui/controller/audit/removal.php @@ -7,7 +7,7 @@ class ControllerAuditRemoval extends Controller { $this->id = "content"; $this->template = "audit/removal.tpl"; - $this->layout = "common/layout"; + $this->layout = "common/layout-audit"; $request = Registry::get('request'); $db = Registry::get('db'); diff --git a/webui/controller/message/bulkremove.php b/webui/controller/message/bulkremove.php index 528b5791..095f6bf0 100644 --- a/webui/controller/message/bulkremove.php +++ b/webui/controller/message/bulkremove.php @@ -40,7 +40,7 @@ class ControllerMessageBulkremove extends Controller { } foreach($idlist as $id) { - $db->query("INSERT INTO " . TABLE_DELETED . " (id, email, reason, date1, deleted) VALUES(?,?,?,?,?)", [$id, $this->data['username'], $this->request->post['reason'], NOW, $deleted]); + $db->query("INSERT INTO " . TABLE_DELETED . " (id, requestor, reason1, date1, deleted) VALUES(?,?,?,?,?)", [$id, $this->data['username'], $this->request->post['reason'], NOW, $deleted]); if(NEED_TO_APPROVE_DELETE) { AUDIT(ACTION_MARK_MESSAGE_FOR_REMOVAL, '', '', $id, ''); diff --git a/webui/model/search/search.php b/webui/model/search/search.php index 2796423c..7e77340b 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -686,13 +686,13 @@ class ModelSearchSearch extends Model { if($id == '') { return 0; } - if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 0) { return 1; } + if((Registry::get('auditor_user') == 1 || Registry::get('data_officer') == 1) && RESTRICTED_AUDITOR == 0) { return 1; } $session = Registry::get('session'); array_push($arr, $id); - if(Registry::get('auditor_user') == 1 && RESTRICTED_AUDITOR == 1) { + if((Registry::get('auditor_user') == 1 || Registry::get('data_officer') == 1) && RESTRICTED_AUDITOR == 1) { if(validdomain($session->get("domain")) == 1) { $q .= ",?"; array_push($a, $session->get("domain")); diff --git a/webui/view/theme/default/templates/common/layout-audit.tpl b/webui/view/theme/default/templates/common/layout-audit.tpl index ed042ff8..8c1e9ef6 100644 --- a/webui/view/theme/default/templates/common/layout-audit.tpl +++ b/webui/view/theme/default/templates/common/layout-audit.tpl @@ -77,7 +77,7 @@ - +