From 87b3867d52dbaf6c3db44cbcbe4d96a4def12dd2 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 5 Nov 2018 18:59:19 +0000 Subject: [PATCH] Introduced org_id in tt_roles table for better security and maintenance. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 11 +++++++---- mysql.sql | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 959fe31d..fe0ad54f 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.18.07.4369 | Copyright © Anuko | +  Anuko Time Tracker 1.18.08.4370 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 5baff57e..b57f157c 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -956,7 +956,7 @@ if ($_POST) { print "Updated $tt_expense_items_updated tt_expense_items records...
\n"; } - if ($_POST["convert11797to11805"]) { + if ($_POST["convert11797to11808"]) { setChange("ALTER TABLE `tt_fav_reports` CHANGE `group_by` `group_by1` varchar(20) default NULL"); setChange("ALTER TABLE `tt_fav_reports` ADD `group_by2` varchar(20) default NULL AFTER `group_by1`"); setChange("ALTER TABLE `tt_fav_reports` ADD `group_by3` varchar(20) default NULL AFTER `group_by2`"); @@ -968,6 +968,9 @@ if ($_POST) { setChange("ALTER TABLE `tt_users` ADD `org_id` int(11) default NULL AFTER `group_id`"); setChange("UPDATE `tt_users` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.06') set org_id = group_id where org_id is null"); setChange("UPDATE `tt_site_config` SET param_value = '1.18.07', modified = now() where param_name = 'version_db' and param_value = '1.18.06'"); + setChange("ALTER TABLE `tt_roles` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("UPDATE `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.07') set org_id = group_id where org_id is null"); + setChange("UPDATE `tt_site_config` SET param_value = '1.18.08', modified = now() where param_name = 'version_db' and param_value = '1.18.07'"); } if ($_POST["cleanup"]) { @@ -1013,7 +1016,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.18.05) + Create database structure (v1.18.08)
(applies only to new installations, do not execute when updating)
@@ -1058,8 +1061,8 @@ if ($_POST) {
Update database structure (v1.17.97 to v1.18.05)Update database structure (v1.17.97 to v1.18.08)
diff --git a/mysql.sql b/mysql.sql index bfa26a0d..79e2b3ff 100644 --- a/mysql.sql +++ b/mysql.sql @@ -53,6 +53,7 @@ CREATE TABLE `tt_groups` ( CREATE TABLE `tt_roles` ( `id` int(11) NOT NULL auto_increment, # Role id. Identifies roles for all groups on the server. `group_id` int(11) NOT NULL, # Group id the role is defined for. + `org_id` int(11) default NULL, # Organization id. `name` varchar(80) default NULL, # Role name - custom role name. In case we are editing a # predefined role (USER, etc.), we can rename the role here. `description` varchar(255) default NULL, # Role description. @@ -459,4 +460,4 @@ CREATE TABLE `tt_site_config` ( PRIMARY KEY (`param_name`) ); -INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.07', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.08', now()); # TODO: change when structure changes. -- 2.20.1