-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpg-ro-role.sql
More file actions
62 lines (55 loc) · 1.82 KB
/
Copy pathpg-ro-role.sql
File metadata and controls
62 lines (55 loc) · 1.82 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Keeps only those privileges that are read-only for every role in the instance
-- except those included in admin_roles array.
do $$
declare
-- add here admin roles not to be modified
admin_roles varchar[] := '{
"0",
"42D0EEB1C66F497A90DD526DC597E6F0"
}';
insecured_process numeric;
begin
-- don't inherit process permission from window
select count(*)
into insecured_process
from ad_preference
where property = 'SecuredProcess'
and ad_user_id is null
and visibleat_client_id is null
and visibleat_org_id is null
and visibleat_role_id is null;
if insecured_process = 0 then
insert into ad_preference
(ad_preference_id, ad_client_id, ad_org_id,
createdby, updatedby,
ispropertylist, property, value)
values
(get_uuid(), '0', '0',
'0', '0',
'Y', 'SecuredProcess', 'Y');
end if;
update ad_window_access
set isreadwrite = 'N'
where not (ad_role_id = any(admin_roles));
-- note there might be processes not marked as report but being
-- actual reports
update ad_process_access pa
set isactive = 'N'
where not (ad_role_id = any(admin_roles))
and exists (select 1
from ad_process p
where pa.ad_process_id = p.ad_process_id
and isjasper ='N'
and isreport = 'N');
update obuiapp_process_access pa
set isactive = 'N'
where not (ad_role_id = any(admin_roles))
and exists (select 1
from obuiapp_process p
where pa.obuiapp_process_id = p.obuiapp_process_id
and uipattern != 'OBUIAPP_Report');
-- note there might be forms used for repoting
update ad_form_access
set isactive = 'N'
where not (ad_role_id = any(admin_roles));
end$$;