aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-11-14 12:00:48 +0300
committerFrederick Muriuki Muriithi2022-11-14 12:00:48 +0300
commitf3295a7d6df0a64c3949fa2e940918cea94f99a1 (patch)
tree5df61aba35d23a513e9638915ef8beb67e7308eb /migrations
parent0144bfbcec8250d495d17c9728c7fca6beffae72 (diff)
downloadgenenetwork3-f3295a7d6df0a64c3949fa2e940918cea94f99a1.tar.gz
Migrations: Create the `group-leader` role and give it privileges
* migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py: new migration * tests/unit/auth/test_migrations_insert_data_into_empty_table.py: test new migration
Diffstat (limited to 'migrations')
-rw-r--r--migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py b/migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py
new file mode 100644
index 0000000..08d0202
--- /dev/null
+++ b/migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py
@@ -0,0 +1,47 @@
+"""
+Initialise basic roles
+"""
+
+from yoyo import step
+
+__depends__ = {'20221114_03_PtWjc-create-group-roles-table'}
+
+steps = [
+ step(
+ """
+ INSERT INTO roles(role_id, role_name) VALUES
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30', 'group-leader')
+ """,
+ "DELETE FROM roles"),
+ step(
+ """
+ INSERT INTO role_privileges(role_id, privilege_id)
+ VALUES
+ -- group-management
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '4842e2aa-38b9-4349-805e-0a99a9cf8bff'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '3ebfe79c-d159-4629-8b38-772cf4bc2261'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '52576370-b3c7-4e6a-9f7e-90e9dbe24d8f'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '13ec2a94-4f1a-442d-aad2-936ad6dd5c57'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ 'ae4add8c-789a-4d11-a6e9-a306470d83d9'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ 'f1bd3f42-567e-4965-9643-6d1a52ddee64'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ 'd4afe2b3-4ca0-4edd-b37d-966535b5e5bd'),
+
+ -- resource-management
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ 'aa25b32a-bff2-418d-b0a2-e26b4a8f089b'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '7f261757-3211-4f28-a43f-a09b800b164d'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ '2f980855-959b-4339-b80e-25d1ec286e21'),
+ ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
+ 'd2a070fd-e031-42fb-ba41-d60cf19e5d6d')
+ """,
+ "DELETE FROM role_privileges")
+]