From 12e89deebc6f0ac7f7047b37e5591d8b1e4d2059 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 12 Oct 2023 17:06:41 +0300 Subject: migrations: Create role for dealing with inbredset groups. --- ..._CS8NZ-create-new-inbredset-group-owner-role.py | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py (limited to 'migrations/auth') 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')) + """) +] -- cgit v1.2.3