aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20230111_01_Wd6IZ-remove-create-group-privilege-from-group-leader.py
blob: 7e7fda22f82b2da635da70b929c38f0faa3291ab (about) (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
"""
remove 'create-group' privilege from group-leader.
"""

from yoyo import step

__depends__ = {'20221219_03_PcTrb-create-authorisation-code-table'}

steps = [
    step(
        """
        DELETE FROM role_privileges
        WHERE role_id='a0e67630-d502-4b9f-b23f-6805d0f30e30'
        AND privilege_id='4842e2aa-38b9-4349-805e-0a99a9cf8bff'
        """,
        """
        INSERT INTO role_privileges VALUES
        ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
        '4842e2aa-38b9-4349-805e-0a99a9cf8bff')
        """),
    step(
        """
        INSERT INTO roles(role_id, role_name, user_editable) VALUES
          ('ade7e6b0-ba9c-4b51-87d0-2af7fe39a347', 'group-creator', '0')
        """,
        """
        DELETE FROM roles WHERE role_id='ade7e6b0-ba9c-4b51-87d0-2af7fe39a347'
        """),
    step(
        """
        INSERT INTO role_privileges VALUES
          ('ade7e6b0-ba9c-4b51-87d0-2af7fe39a347',
           '4842e2aa-38b9-4349-805e-0a99a9cf8bff')
        """,
        """
        DELETE FROM role_privileges
        WHERE role_id='ade7e6b0-ba9c-4b51-87d0-2af7fe39a347'
        AND privilege_id='4842e2aa-38b9-4349-805e-0a99a9cf8bff'
        """)
]