aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-10-12 17:06:41 +0300
committerFrederick Muriuki Muriithi2023-10-12 17:06:41 +0300
commit12e89deebc6f0ac7f7047b37e5591d8b1e4d2059 (patch)
tree389dc6cf0be5a10c43f4d62c88f539bd7bbd14e3 /migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py
parentfc3287d7ad66e0b1551b3c1e5e4d55918cfdcc12 (diff)
downloadgn-auth-12e89deebc6f0ac7f7047b37e5591d8b1e4d2059.tar.gz
migrations: Create role for dealing with inbredset groups.
Diffstat (limited to 'migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py')
-rw-r--r--migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py b/migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py
new file mode 100644
index 0000000..a4238ed
--- /dev/null
+++ b/migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py
@@ -0,0 +1,40 @@
+"""
+Create new 'inbredset-group-owner' role
+"""
+
+from yoyo import step
+
+__depends__ = {'20231002_01_tzxTf-link-inbredsets-to-auth-system'}
+
+steps = [
+ step(
+ """
+ INSERT INTO roles(role_id, role_name, user_editable)
+ VALUES('bde1c08b-b067-4d56-8353-462fc5928c32', 'inbredset-group-owner', 0)
+ """,
+ """
+ DELETE FROM roles WHERE role_id='bde1c08b-b067-4d56-8353-462fc5928c32'
+ """),
+ step(
+ """
+ INSERT INTO role_privileges(role_id, privilege_id)
+ VALUES
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:apply-case-attribute-edit'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:create-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:delete-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:edit-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:reject-case-attribute-edit'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:view-case-attribute')
+ """,
+ """
+ DELETE FROM role_privileges
+ WHERE (role_id, privilege_id)
+ IN
+ (('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:apply-case-attribute-edit'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:create-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:delete-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:edit-case-attribute'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:reject-case-attribute-edit'),
+ ('bde1c08b-b067-4d56-8353-462fc5928c32', 'system:inbredset:view-case-attribute'))
+ """)
+]