-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path019_update_permissions_v1-11.sql
47 lines (37 loc) · 3.13 KB
/
019_update_permissions_v1-11.sql
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
/*
GROUP HEADERS GENERATED BY: https://patorjk.com/software/taag/#p=display&h=0&v=1&c=c&f=ANSI%20Shadow&t=STAGE%20FUNCS
SUB GROUP HEADERS GENERATED BY: https://patorjk.com/software/taag/#p=display&h=1&v=1&c=c&f=Banner3&t=permissions
*/
set search_path = public, const, ext, stage, helpers, internal, unsecure;
select *
from check_version('1.10', _component := 'keen_auth_permissions', _throw_err := true);
select *
from start_version_update('1.11',
'Fix of unsecure.assign_permissions and incorrectly assigned permissions',
_component := 'keen_auth_permissions');
/***
* ███████╗██╗██╗ ██╗███████╗███████╗
* ██╔════╝██║╚██╗██╔╝██╔════╝██╔════╝
* █████╗ ██║ ╚███╔╝ █████╗ ███████╗
* ██╔══╝ ██║ ██╔██╗ ██╔══╝ ╚════██║
* ██║ ██║██╔╝ ██╗███████╗███████║
* ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝
*
*/
create unique index uq_auth_permission_assignment_tenant_user on auth.permission_assignment (tenant_id, user_id,
coalesce(perm_set_id, 0),
coalesce(permission_id, 0));
create unique index uq_auth_permission_assignment_tenant_group on auth.permission_assignment (tenant_id, group_id,
coalesce(perm_set_id, 0),
coalesce(permission_id, 0));
/***
* ██████╗ ██████╗ ███████╗████████╗ ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗
* ██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝ ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝
* ██████╔╝██║ ██║███████╗ ██║ ██║ ██████╔╝█████╗ ███████║ ██║ █████╗
* ██╔═══╝ ██║ ██║╚════██║ ██║ ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝
* ██║ ╚██████╔╝███████║ ██║ ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗
* ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
*
*/
select *
from stop_version_update('1.11', _component := 'keen_auth_permissions');