aboutsummaryrefslogtreecommitdiff
path: root/migrations/auth/20221114_04_tLUzB-initialise-basic-roles.py
blob: 08d0202b6c0a6f6eca2d27d3c08d17c89d08fac5 (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
41
42
43
44
45
46
47
"""
Initialise basic roles
"""

from yoyo import step

__depends__ = {'20221114_03_PtWjc-create-group-roles-table'}

steps = [
    step(
        """
        INSERT INTO roles(role_id, role_name) VALUES
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30', 'group-leader')
        """,
        "DELETE FROM roles"),
    step(
        """
        INSERT INTO role_privileges(role_id, privilege_id)
        VALUES
            -- group-management
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '4842e2aa-38b9-4349-805e-0a99a9cf8bff'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '3ebfe79c-d159-4629-8b38-772cf4bc2261'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '52576370-b3c7-4e6a-9f7e-90e9dbe24d8f'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '13ec2a94-4f1a-442d-aad2-936ad6dd5c57'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             'ae4add8c-789a-4d11-a6e9-a306470d83d9'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             'f1bd3f42-567e-4965-9643-6d1a52ddee64'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             'd4afe2b3-4ca0-4edd-b37d-966535b5e5bd'),

            -- resource-management
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             'aa25b32a-bff2-418d-b0a2-e26b4a8f089b'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '7f261757-3211-4f28-a43f-a09b800b164d'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             '2f980855-959b-4339-b80e-25d1ec286e21'),
            ('a0e67630-d502-4b9f-b23f-6805d0f30e30',
             'd2a070fd-e031-42fb-ba41-d60cf19e5d6d')
        """,
        "DELETE FROM role_privileges")
]