diff --git a/database.sql b/database.sql index 579f874..a4e8264 100644 --- a/database.sql +++ b/database.sql @@ -1,5 +1,5 @@ -- MySQL Script generated by MySQL Workbench --- Mon 21 May 2018 04:05:27 PM MDT +-- Tue 24 Jul 2018 01:22:42 AM MDT -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering @@ -12,15 +12,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- ----------------------------------------------------- --- Schema accounthub --- ----------------------------------------------------- -CREATE SCHEMA IF NOT EXISTS `accounthub` DEFAULT CHARACTER SET utf8 ; -USE `accounthub` ; - --- ----------------------------------------------------- --- Table `accounthub`.`acctstatus` +-- Table `acctstatus` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`acctstatus` ( +CREATE TABLE IF NOT EXISTS `acctstatus` ( `statusid` INT NOT NULL AUTO_INCREMENT, `statuscode` VARCHAR(45) NOT NULL, PRIMARY KEY (`statusid`), @@ -30,9 +24,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`accttypes` +-- Table `accttypes` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`accttypes` ( +CREATE TABLE IF NOT EXISTS `accttypes` ( `typeid` INT NOT NULL AUTO_INCREMENT, `typecode` VARCHAR(45) NOT NULL, PRIMARY KEY (`typeid`), @@ -42,9 +36,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`accounts` +-- Table `accounts` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`accounts` ( +CREATE TABLE IF NOT EXISTS `accounts` ( `uid` INT NOT NULL AUTO_INCREMENT, `username` VARCHAR(190) NOT NULL, `password` VARCHAR(255) NULL, @@ -65,21 +59,21 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`accounts` ( INDEX `fk_accounts_accttypes1_idx` (`accttype` ASC), CONSTRAINT `fk_accounts_acctstatus` FOREIGN KEY (`acctstatus`) - REFERENCES `accounthub`.`acctstatus` (`statusid`) + REFERENCES `acctstatus` (`statusid`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_accounts_accttypes1` FOREIGN KEY (`accttype`) - REFERENCES `accounthub`.`accttypes` (`typeid`) + REFERENCES `accttypes` (`typeid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`apps` +-- Table `apps` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`apps` ( +CREATE TABLE IF NOT EXISTS `apps` ( `appid` INT NOT NULL AUTO_INCREMENT, `appname` VARCHAR(45) NULL, `appcode` VARCHAR(45) NULL, @@ -89,9 +83,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`available_apps` +-- Table `available_apps` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`available_apps` ( +CREATE TABLE IF NOT EXISTS `available_apps` ( `appid` INT NOT NULL, `uid` INT NOT NULL, PRIMARY KEY (`appid`, `uid`), @@ -99,21 +93,21 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`available_apps` ( INDEX `fk_apps_has_accounts_apps1_idx` (`appid` ASC), CONSTRAINT `fk_apps_has_accounts_apps1` FOREIGN KEY (`appid`) - REFERENCES `accounthub`.`apps` (`appid`) + REFERENCES `apps` (`appid`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_apps_has_accounts_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`apikeys` +-- Table `apikeys` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`apikeys` ( +CREATE TABLE IF NOT EXISTS `apikeys` ( `key` VARCHAR(60) NOT NULL, `notes` TEXT NULL, PRIMARY KEY (`key`)) @@ -121,9 +115,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`groups` +-- Table `groups` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`groups` ( +CREATE TABLE IF NOT EXISTS `groups` ( `groupid` INT NOT NULL AUTO_INCREMENT, `groupname` VARCHAR(45) NOT NULL, PRIMARY KEY (`groupid`), @@ -133,9 +127,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`assigned_groups` +-- Table `assigned_groups` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`assigned_groups` ( +CREATE TABLE IF NOT EXISTS `assigned_groups` ( `groupid` INT NOT NULL, `uid` INT NOT NULL, PRIMARY KEY (`groupid`, `uid`), @@ -143,42 +137,42 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`assigned_groups` ( INDEX `fk_groups_has_accounts_groups1_idx` (`groupid` ASC), CONSTRAINT `fk_groups_has_accounts_groups1` FOREIGN KEY (`groupid`) - REFERENCES `accounthub`.`groups` (`groupid`) + REFERENCES `groups` (`groupid`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_groups_has_accounts_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`managers` +-- Table `managers` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`managers` ( +CREATE TABLE IF NOT EXISTS `managers` ( `managerid` INT NOT NULL, `employeeid` INT NOT NULL, PRIMARY KEY (`managerid`, `employeeid`), INDEX `fk_managers_accounts2_idx` (`employeeid` ASC), CONSTRAINT `fk_managers_accounts1` FOREIGN KEY (`managerid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_managers_accounts2` FOREIGN KEY (`employeeid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`logtypes` +-- Table `logtypes` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`logtypes` ( +CREATE TABLE IF NOT EXISTS `logtypes` ( `logtype` INT NOT NULL, `typename` VARCHAR(45) NULL, PRIMARY KEY (`logtype`), @@ -187,9 +181,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`authlog` +-- Table `authlog` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`authlog` ( +CREATE TABLE IF NOT EXISTS `authlog` ( `logid` INT NOT NULL AUTO_INCREMENT, `logtime` DATETIME NOT NULL, `logtype` INT NOT NULL, @@ -202,21 +196,21 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`authlog` ( INDEX `fk_authlog_accounts1_idx` (`uid` ASC), CONSTRAINT `fk_authlog_logtypes1` FOREIGN KEY (`logtype`) - REFERENCES `accounthub`.`logtypes` (`logtype`) + REFERENCES `logtypes` (`logtype`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_authlog_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`permissions` +-- Table `permissions` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`permissions` ( +CREATE TABLE IF NOT EXISTS `permissions` ( `permid` INT NOT NULL AUTO_INCREMENT, `permcode` VARCHAR(45) NOT NULL, `perminfo` VARCHAR(200) NULL, @@ -226,9 +220,9 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`assigned_permissions` +-- Table `assigned_permissions` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`assigned_permissions` ( +CREATE TABLE IF NOT EXISTS `assigned_permissions` ( `uid` INT NOT NULL, `permid` INT NOT NULL, PRIMARY KEY (`uid`, `permid`), @@ -236,21 +230,21 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`assigned_permissions` ( INDEX `fk_permissions_has_accounts_permissions1_idx` (`permid` ASC), CONSTRAINT `fk_permissions_has_accounts_permissions1` FOREIGN KEY (`permid`) - REFERENCES `accounthub`.`permissions` (`permid`) + REFERENCES `permissions` (`permid`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_permissions_has_accounts_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`mobile_codes` +-- Table `mobile_codes` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`mobile_codes` ( +CREATE TABLE IF NOT EXISTS `mobile_codes` ( `codeid` INT NOT NULL AUTO_INCREMENT, `uid` INT NOT NULL, `code` VARCHAR(45) NOT NULL DEFAULT '', @@ -261,16 +255,16 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`mobile_codes` ( UNIQUE INDEX `code_UNIQUE` (`code` ASC), CONSTRAINT `fk_mobile_codes_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `accounthub`.`rate_limit` +-- Table `rate_limit` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`rate_limit` ( +CREATE TABLE IF NOT EXISTS `rate_limit` ( `ipaddr` VARCHAR(45) NOT NULL, `lastaction` DATETIME NULL, PRIMARY KEY (`ipaddr`)) @@ -278,9 +272,9 @@ ENGINE = MEMORY; -- ----------------------------------------------------- --- Table `accounthub`.`onetimekeys` +-- Table `onetimekeys` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `accounthub`.`onetimekeys` ( +CREATE TABLE IF NOT EXISTS `onetimekeys` ( `key` VARCHAR(10) NOT NULL, `uid` INT NOT NULL, `expires` DATETIME NOT NULL, @@ -289,7 +283,30 @@ CREATE TABLE IF NOT EXISTS `accounthub`.`onetimekeys` ( UNIQUE INDEX `key_UNIQUE` (`key` ASC), CONSTRAINT `fk_onetimekeys_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `notifications` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `notifications` ( + `notificationid` INT NOT NULL AUTO_INCREMENT, + `uid` INT NOT NULL, + `timestamp` DATETIME NOT NULL, + `title` VARCHAR(255) NOT NULL, + `content` TINYTEXT NOT NULL, + `url` VARCHAR(255) NOT NULL, + `seen` TINYINT(1) NOT NULL DEFAULT 0, + `sensitive` TINYINT(1) NOT NULL, + PRIMARY KEY (`notificationid`, `uid`), + UNIQUE INDEX `notificationid_UNIQUE` (`notificationid` ASC), + INDEX `fk_notifications_accounts1_idx` (`uid` ASC), + CONSTRAINT `fk_notifications_accounts1` + FOREIGN KEY (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; @@ -300,79 +317,75 @@ SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -- ----------------------------------------------------- --- Data for table `accounthub`.`acctstatus` +-- Data for table `acctstatus` -- ----------------------------------------------------- START TRANSACTION; -USE `accounthub`; -INSERT INTO `accounthub`.`acctstatus` (`statusid`, `statuscode`) VALUES (1, 'NORMAL'); -INSERT INTO `accounthub`.`acctstatus` (`statusid`, `statuscode`) VALUES (2, 'LOCKED_OR_DISABLED'); -INSERT INTO `accounthub`.`acctstatus` (`statusid`, `statuscode`) VALUES (3, 'CHANGE_PASSWORD'); -INSERT INTO `accounthub`.`acctstatus` (`statusid`, `statuscode`) VALUES (4, 'TERMINATED'); -INSERT INTO `accounthub`.`acctstatus` (`statusid`, `statuscode`) VALUES (5, 'ALERT_ON_ACCESS'); +INSERT INTO `acctstatus` (`statusid`, `statuscode`) VALUES (1, 'NORMAL'); +INSERT INTO `acctstatus` (`statusid`, `statuscode`) VALUES (2, 'LOCKED_OR_DISABLED'); +INSERT INTO `acctstatus` (`statusid`, `statuscode`) VALUES (3, 'CHANGE_PASSWORD'); +INSERT INTO `acctstatus` (`statusid`, `statuscode`) VALUES (4, 'TERMINATED'); +INSERT INTO `acctstatus` (`statusid`, `statuscode`) VALUES (5, 'ALERT_ON_ACCESS'); COMMIT; -- ----------------------------------------------------- --- Data for table `accounthub`.`accttypes` +-- Data for table `accttypes` -- ----------------------------------------------------- START TRANSACTION; -USE `accounthub`; -INSERT INTO `accounthub`.`accttypes` (`typeid`, `typecode`) VALUES (1, 'LOCAL'); -INSERT INTO `accounthub`.`accttypes` (`typeid`, `typecode`) VALUES (2, 'LDAP'); -INSERT INTO `accounthub`.`accttypes` (`typeid`, `typecode`) VALUES (3, 'LIGHT'); +INSERT INTO `accttypes` (`typeid`, `typecode`) VALUES (1, 'LOCAL'); +INSERT INTO `accttypes` (`typeid`, `typecode`) VALUES (2, 'LDAP'); +INSERT INTO `accttypes` (`typeid`, `typecode`) VALUES (3, 'LIGHT'); COMMIT; -- ----------------------------------------------------- --- Data for table `accounthub`.`logtypes` +-- Data for table `logtypes` -- ----------------------------------------------------- START TRANSACTION; -USE `accounthub`; -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (1, 'PORTAL_LOGIN_OK'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (2, 'PORTAL_LOGIN_FAILED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (3, 'PASSWORD_CHANGED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (4, 'API_LOGIN_OK'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (5, 'API_LOGIN_FAILED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (6, 'PORTAL_BAD_AUTHCODE'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (7, 'API_BAD_AUTHCODE'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (8, 'BAD_CAPTCHA'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (9, '2FA_ADDED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (10, '2FA_REMOVED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (11, 'PORTAL_LOGOUT'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (12, 'API_AUTH_OK'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (13, 'API_AUTH_FAILED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (14, 'API_BAD_KEY'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (15, 'LOG_CLEARED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (16, 'USER_REMOVED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (17, 'USER_ADDED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (18, 'USER_EDITED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (19, 'MOBILE_LOGIN_OK'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (20, 'MOBILE_LOGIN_FAILED'); -INSERT INTO `accounthub`.`logtypes` (`logtype`, `typename`) VALUES (21, 'MOBILE_BAD_KEY'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (1, 'PORTAL_LOGIN_OK'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (2, 'PORTAL_LOGIN_FAILED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (3, 'PASSWORD_CHANGED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (4, 'API_LOGIN_OK'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (5, 'API_LOGIN_FAILED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (6, 'PORTAL_BAD_AUTHCODE'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (7, 'API_BAD_AUTHCODE'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (8, 'BAD_CAPTCHA'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (9, '2FA_ADDED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (10, '2FA_REMOVED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (11, 'PORTAL_LOGOUT'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (12, 'API_AUTH_OK'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (13, 'API_AUTH_FAILED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (14, 'API_BAD_KEY'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (15, 'LOG_CLEARED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (16, 'USER_REMOVED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (17, 'USER_ADDED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (18, 'USER_EDITED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (19, 'MOBILE_LOGIN_OK'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (20, 'MOBILE_LOGIN_FAILED'); +INSERT INTO `logtypes` (`logtype`, `typename`) VALUES (21, 'MOBILE_BAD_KEY'); COMMIT; -- ----------------------------------------------------- --- Data for table `accounthub`.`permissions` +-- Data for table `permissions` -- ----------------------------------------------------- START TRANSACTION; -USE `accounthub`; -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (1, 'ADMIN', 'System administrator'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (100, 'INV_VIEW', 'Access inventory system'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (101, 'INV_EDIT', 'Edit inventory system'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (200, 'TASKFLOOR', 'Access TaskFloor'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (300, 'QWIKCLOCK', 'Access QwikClock and punch in/out'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (301, 'QWIKCLOCK_MANAGE', 'Edit punches and other data for managed users'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (302, 'QWIKCLOCK_EDITSELF', 'Edit own punches and other data'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (303, 'QWIKCLOCK_ADMIN', 'Add and edit shifts and other data for all users'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (400, 'SITEWRITER', 'Manage and edit websites, messages, and analytics'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (401, 'SITEWRITER_CONTACT', 'Manage messages sent via website contact forms'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (402, 'SITEWRITER_ANALYTICS', 'View website analytics'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (403, 'SITEWRITER_EDIT', 'Edit website content'); -INSERT INTO `accounthub`.`permissions` (`permid`, `permcode`, `perminfo`) VALUES (404, 'SITEWRITER_FILES', 'Manage and upload files'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (1, 'ADMIN', 'System administrator'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (100, 'INV_VIEW', 'Access inventory system'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (101, 'INV_EDIT', 'Edit inventory system'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (200, 'TASKFLOOR', 'Access TaskFloor'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (300, 'QWIKCLOCK', 'Access QwikClock and punch in/out'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (301, 'QWIKCLOCK_MANAGE', 'Edit punches and other data for managed users'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (302, 'QWIKCLOCK_EDITSELF', 'Edit own punches and other data'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (303, 'QWIKCLOCK_ADMIN', 'Add and edit shifts and other data for all users'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (400, 'SITEWRITER', 'Manage and edit websites, messages, and analytics'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (401, 'SITEWRITER_CONTACT', 'Manage messages sent via website contact forms'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (402, 'SITEWRITER_ANALYTICS', 'View website analytics'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (403, 'SITEWRITER_EDIT', 'Edit website content'); +INSERT INTO `permissions` (`permid`, `permcode`, `perminfo`) VALUES (404, 'SITEWRITER_FILES', 'Manage and upload files'); COMMIT;