aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20221116_01_nKUmX-add-privileges-to-group-leader-role.py
blob: 2e4ae289941bd809a46ec39bb8397c3179dad287 (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
"""
Add privileges to 'group-leader' role.
"""

from yoyo import step

__depends__ = {'20221114_05_hQun6-create-user-roles-table'}

steps = [
    step(
        """
        INSERT INTO role_privileges(role_id, privilege_id)
        VALUES
            -- role management
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '221660b1-df05-4be1-b639-f010269dbda9'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '7bcca363-cba9-4169-9e31-26bdc6179b28'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '5103cc68-96f8-4ebb-83a4-a31692402c9b'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '1c59eff5-9336-4ed2-a166-8f70d4cb012e')
        """,
        """
        DELETE FROM role_privileges
        WHERE
            role_id='a0e67630-d502-4b9f-b23f-6805d0f30e30'
        AND privilege_id IN (
            '221660b1-df05-4be1-b639-f010269dbda9',
            '7bcca363-cba9-4169-9e31-26bdc6179b28',
            '5103cc68-96f8-4ebb-83a4-a31692402c9b',
            '1c59eff5-9336-4ed2-a166-8f70d4cb012e'
        )
        """)
]