mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
User roles
Move the default user roles into the database to make way for custom roles & permissions
This commit is contained in:
@@ -1889,14 +1889,25 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
||||
if (CURRENT_DATABASE_VERSION == '1.2.9') {
|
||||
|
||||
mysqli_query($mysqli, "CREATE TABLE `user_permissions` (`user_id` int(11) NOT NULL,`client_id` int(11) NOT NULL, PRIMARY KEY (`user_id`,`client_id`))");
|
||||
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.0'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.3.0') {
|
||||
// // Insert queries here required to update to DB version 1.3.0
|
||||
if (CURRENT_DATABASE_VERSION == '1.3.0') {
|
||||
|
||||
mysqli_query($mysqli, "CREATE TABLE `itflow`.`user_roles` (`user_role_id` INT(11) NOT NULL AUTO_INCREMENT , `user_role_name` VARCHAR(200) NOT NULL , `user_role_description` VARCHAR(200) NULL DEFAULT NULL , `user_role_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , `user_role_updated_at` DATETIME on update CURRENT_TIMESTAMP NULL , `user_role_archived_at` DATETIME NULL , PRIMARY KEY (`user_role_id`)) ENGINE = InnoDB");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO `user_roles` SET user_role_id = 1, user_role_name = 'Accountant', user_role_description = 'Built-in - Limited access to financial-focused modules'");
|
||||
mysqli_query($mysqli, "INSERT INTO `user_roles` SET user_role_id = 2, user_role_name = 'Technician', user_role_description = 'Built-in - Limited access to technical-focused modules'");
|
||||
mysqli_query($mysqli, "INSERT INTO `user_roles` SET user_role_id = 3, user_role_name = 'Administrator', user_role_description = 'Built-in - Full administrative access to all modules (including user management)'");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.1'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.3.1') {
|
||||
// // Insert queries here required to update to DB version 1.3.1
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.1");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.2'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user