-- You can filter results in last lines of query
WITH all_user_roles AS (
SELECT DISTINCT connect_by_root(grantee) username, granted_role, sys_connect_by_path(granted_role, '->') PATH, admin_option
FROM dba_role_privs p
START WITH grantee IN (SELECT username FROM dba_users)
CONNECT BY PRIOR granted_role = grantee
)
--SELECT * FROM all_user_roles;
, grantee AS (
SELECT username , granted_role, PATH FROM all_user_roles
UNION
SELECT username, NULL granted_role, 'DIRECT' AS PATH FROM dba_users
)
--SELECT * FROM grantee;
, priv_list AS (
SELECT 'ROLE' priv_type, username, granted_role priv, NULL AS owner, NULL AS table_name, NULL AS column_name, admin_option grantable, PATH
FROM all_user_roles
UNION
SELECT 'SYSTEM' priv_type, username, privilege priv, NULL AS owner, NULL AS table_name, NULL AS column_name, admin_option, PATH
FROM dba_sys_privs, grantee
WHERE grantee = grantee.username
UNION
SELECT 'TABLE' priv_type, username, PRIVILEGE, owner, table_name, NULL AS column_name, grantable, PATH
FROM dba_tab_privs, grantee
WHERE grantee = grantee.username
UNION
SELECT 'COLUMN' priv_type, username, PRIVILEGE, owner, table_name, column_name, grantable, PATH
FROM dba_col_privs, grantee
WHERE grantee = grantee.username)
SELECT *
FROM priv_list
WHERE priv = 'ALTER USER'
;
2021-10-29
All privileges for all users
Подписаться на:
Сообщения (Atom)