From: Nik Okuntseff Date: Wed, 21 Feb 2018 15:00:16 +0000 (+0000) Subject: Work in progress on new roles. X-Git-Tag: timetracker_1.19-1~1106 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=73d14da2b2bf18a91937cf08ee3da6e62f2d01e0;p=timetracker.git Work in progress on new roles. --- diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index f4b18e78..11ff3730 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.17.27.4005 | Copyright © Anuko | +  Anuko Time Tracker 1.17.28.4006 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 5c02031f..41864c45 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -709,7 +709,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_log` ADD `paid` tinyint(4) NULL default '0' AFTER `billable`"); } - if ($_POST["convert11400to11727"]) { + if ($_POST["convert11400to11728"]) { setChange("ALTER TABLE `tt_teams` DROP `address`"); setChange("ALTER TABLE `tt_fav_reports` ADD `report_spec` text default NULL AFTER `user_id`"); setChange("ALTER TABLE `tt_fav_reports` ADD `paid_status` tinyint(4) default NULL AFTER `invoice`"); @@ -729,6 +729,8 @@ if ($_POST) { setChange("ALTER TABLE `tt_teams` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); setChange("ALTER TABLE `tt_log` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); setChange("ALTER TABLE `tt_tmp_refs` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); + setChange("CREATE TABLE `tt_roles` (`id` int(11) NOT NULL auto_increment, `team_id` int(11) NOT NULL, `name` varchar(80) default NULL, `rank` int(11) default 0, `rights` text default NULL, `status` tinyint(4) default 1, PRIMARY KEY (`id`))"); + setChange("create unique index role_idx on tt_roles(team_id, rank, status)"); } if ($_POST["cleanup"]) { @@ -773,7 +775,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.17.27) + Create database structure (v1.17.28)
(applies only to new installations, do not execute when updating)
@@ -809,8 +811,8 @@ if ($_POST) {

Update database structure (v1.14 to v1.17.27)
Update database structure (v1.14 to v1.17.28)
diff --git a/mysql.sql b/mysql.sql index 06f705cc..3c52aefc 100644 --- a/mysql.sql +++ b/mysql.sql @@ -380,3 +380,24 @@ CREATE TABLE `tt_monthly_quotas` ( ALTER TABLE `tt_monthly_quotas` ADD CONSTRAINT `FK_TT_TEAM_CONSTRAING` FOREIGN KEY (`team_id`) REFERENCES `tt_teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + + +# +# Structure for table tt_roles. This table stores customized team roles. +# +CREATE TABLE `tt_roles` ( + `id` int(11) NOT NULL auto_increment, # role id + `team_id` int(11) NOT NULL, # team id + `name` varchar(80) default NULL, # role name - may be used to rename standard roles + `rank` int(11) default 0, # Role rank and identifier in comparison with other roles, + # used to determine what "lesser roles" are + # and also identifies a role within a team, used as role in tt_users. + `rights` text default NULL, # Comma-separated list of rights assigned to a role. + # NULL here for predefined roles (4, 16, 68, 324 - manager) + # means a hard-coded set of default access rights. + `status` tinyint(4) default 1, # role status + PRIMARY KEY (`id`) +); + +# Create an index that guarantees unique active and inactive role ranks per team. +create unique index role_idx on tt_roles(team_id, rank, status);