From: Nik Okuntseff Date: Wed, 28 Feb 2018 17:15:41 +0000 (+0000) Subject: Introduced site admin and top manager roles in tt_roles with team_id 0. X-Git-Tag: timetracker_1.19-1~1077 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7706d5a5ca4aa6f4f093beadbf688d2cccaa4bef;p=timetracker.git Introduced site admin and top manager roles in tt_roles with team_id 0. --- diff --git a/WEB-INF/lib/ttRoleHelper.class.php b/WEB-INF/lib/ttRoleHelper.class.php index f96d7c47..0cf5f446 100644 --- a/WEB-INF/lib/ttRoleHelper.class.php +++ b/WEB-INF/lib/ttRoleHelper.class.php @@ -162,7 +162,7 @@ class ttRoleHelper { $rights_user = 'data_entry,view_own_data,manage_own_settings,view_users'; $rights_supervisor = $rights_user.',on_behalf_data_entry,view_data,override_punch_mode,swap_roles,approve_timesheets'; $rights_comanager = $rights_supervisor.',manage_users,manage_projects,manage_tasks,manage_custom_fields,manage_clients,manage_invoices'; - $rights_manager = $rights_comanager.'manage_features,manage_basic_settings,manage_advanced_settings,manage_roles,export_data,manage_subgroups'; + $rights_manager = $rights_comanager.',manage_features,manage_basic_settings,manage_advanced_settings,manage_roles,export_data,manage_subgroups'; // Active roles. $name = $mdb2->quote($i18n->getKey('role.user.label')); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 8fb80ce6..642762fa 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.34.4034 | Copyright © Anuko | +  Anuko Time Tracker 1.17.35.4035 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 7f87d7b7..b755a8bd 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -32,6 +32,8 @@ require_once('initialize.php'); import('ttUserHelper'); import('ttTaskHelper'); +// setChange - executes an sql statement. TODO: rename this function to something better. +// Better yet, redo the entire thing and make an installer. function setChange($sql) { print "
".$sql."
"; $mdb2 = getConnection(); @@ -42,6 +44,7 @@ function setChange($sql) { print "successful update
\n"; } + if ($request->isGet()) { echo('

Environment Checks

'); @@ -735,6 +738,10 @@ if ($_POST) { setChange("ALTER TABLE `tt_users` ADD `role_id` int(11) default NULL AFTER `role`"); setChange("CREATE TABLE `tt_site_config` (`param_name` varchar(32) NOT NULL, `param_value` text default NULL, `created` datetime default NULL, `updated` datetime default NULL, PRIMARY KEY (`param_name`))"); setChange("INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.34', now())"); + setChange("DELETE from `tt_roles` WHERE team_id = 0"); + setChange("INSERT INTO `tt_roles` (`team_id`, `name`, `rank`, `rights`) VALUES (0, 'Site administrator', 1024, 'administer_site')"); + setChange("INSERT INTO `tt_roles` (`team_id`, `name`, `rank`, `rights`) VALUES (0, 'Top manager', 512, 'data_entry,view_own_data,manage_own_settings,view_users,on_behalf_data_entry,view_data,override_punch_mode,swap_roles,approve_timesheets,manage_users,manage_projects,manage_tasks,manage_custom_fields,manage_clients,manage_invoices,manage_features,manage_basic_settings,manage_advanced_settings,manage_roles,export_data,manage_subgroups')"); + setChange("UPDATE `tt_site_config` SET `param_value` = '1.17.35' where param_name = 'version_db'"); } if ($_POST["cleanup"]) { diff --git a/mysql.sql b/mysql.sql index fad0f92d..c625e8c1 100644 --- a/mysql.sql +++ b/mysql.sql @@ -409,6 +409,10 @@ CREATE TABLE `tt_roles` ( # Create an index that guarantees unique active and inactive role ranks in each group. create unique index role_idx on tt_roles(team_id, rank, status); +# Insert site-wide roles - site administrator and top manager. +DELETE from `tt_roles` WHERE team_id = 0; +INSERT INTO `tt_roles` (`team_id`, `name`, `rank`, `rights`) VALUES (0, 'Site administrator', 1024, 'administer_site'); +INSERT INTO `tt_roles` (`team_id`, `name`, `rank`, `rights`) VALUES (0, 'Top manager', 512, 'data_entry,view_own_data,manage_own_settings,view_users,on_behalf_data_entry,view_data,override_punch_mode,swap_roles,approve_timesheets,manage_users,manage_projects,manage_tasks,manage_custom_fields,manage_clients,manage_invoices,manage_features,manage_basic_settings,manage_advanced_settings,manage_roles,export_data,manage_subgroups'); # # Structure for table tt_site_config. This table stores configuration data @@ -423,4 +427,4 @@ CREATE TABLE `tt_site_config` ( PRIMARY KEY (`param_name`) ); -INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.34', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.35', now()); # TODO: change when structure changes.