aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20231011_01_CS8NZ-create-new-inbredset-group-owner-role.py
blob: a4238ed72a5fcb5f8e8416180b566a203ad43196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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'))
        """)
]