Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4979cf9

Browse files
committed
Added check for sys grants added via role when installing utPLSQL framework.
Resolves #1050
1 parent 63f17a2 commit 4979cf9

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

source/check_sys_grants.sql

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,29 @@ begin
1212
end if;
1313
end loop;
1414
end if;
15+
16+
with
17+
x as (
18+
select '' as remove from dual
19+
union all
20+
select ' ANY' as remove from dual
21+
)
1522
select listagg(' - '||privilege,CHR(10)) within group(order by privilege)
16-
into l_missing_grants
17-
from (
18-
select column_value as privilege
19-
from table(l_expected_grants)
20-
minus
21-
(select privilege
22-
from user_sys_privs
23-
union all
24-
select replace(privilege,' ANY') privilege
25-
from user_sys_privs)
26-
);
23+
into l_missing_grants
24+
from (
25+
select column_value as privilege
26+
from table(l_expected_grants)
27+
minus (
28+
select replace(p.privilege, x.remove) as privilege
29+
from role_sys_privs p
30+
join session_roles r using (role)
31+
cross join x
32+
union all
33+
select replace(p.privilege, x.remove) as privilege
34+
from user_sys_privs p
35+
cross join x
36+
)
37+
);
2738
if l_missing_grants is not null then
2839
raise_application_error(
2940
-20000

0 commit comments

Comments
 (0)