aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/auth')
-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'))
+ """)
+]