From ae2cae9f875c1cd690a1c27e9b900a8a3bb96484 Mon Sep 17 00:00:00 2001 From: Ty Eggen Date: Sun, 1 Dec 2024 21:23:45 +0000 Subject: [PATCH] schema: unique privilege codes and add default privileges --- ...force_unique_codes_in_privileges_table.sql | 8 ++++ ...1733087966946__Add_standard_privileges.sql | 42 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 migrations/28/V28.1733087920185__Enforce_unique_codes_in_privileges_table.sql create mode 100644 migrations/28/V28.1733087966946__Add_standard_privileges.sql diff --git a/migrations/28/V28.1733087920185__Enforce_unique_codes_in_privileges_table.sql b/migrations/28/V28.1733087920185__Enforce_unique_codes_in_privileges_table.sql new file mode 100644 index 00000000..d89ebb71 --- /dev/null +++ b/migrations/28/V28.1733087920185__Enforce_unique_codes_in_privileges_table.sql @@ -0,0 +1,8 @@ +SET + SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; + +START TRANSACTION; + +ALTER TABLE `privileges` ADD UNIQUE (`code`); + +COMMIT; diff --git a/migrations/28/V28.1733087966946__Add_standard_privileges.sql b/migrations/28/V28.1733087966946__Add_standard_privileges.sql new file mode 100644 index 00000000..16cd77c3 --- /dev/null +++ b/migrations/28/V28.1733087966946__Add_standard_privileges.sql @@ -0,0 +1,42 @@ +SET + SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; + +START TRANSACTION; + +INSERT IGNORE INTO `privileges` (name, description, code, enabled) +VALUES + ( + 'Edit Full Profile', + 'Permission to edit all profile fields', + 'full-profile', + 1 + ); + +INSERT IGNORE INTO `privileges` (name, description, code, enabled) +VALUES + ( + 'Web Hook Service', + 'Service privilege for webhooker', + 'webhook', + 1 + ); + +INSERT IGNORE INTO `privileges` (name, description, code, enabled) +VALUES + ( + 'OAuth Provider', + 'OAuth Provider Privilege', + 'oauth', + 1 + ); + +INSERT IGNORE INTO `privileges` (name, description, code, enabled) +VALUES + ( + 'Generate Temporary Pins', + 'This privilege would allow users to generate temporary pins.', + 'gen-temp-pin', + 0 + ); + +COMMIT;