2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

42
vdh/all_granted_roles.sql Normal file
View File

@@ -0,0 +1,42 @@
-- show all roles for a user, either directly assigned or nested via other roles
with user_role_hierarchy
as ( select
t2.name username, t1.granted_role
from
( select
distinct sa.userid, u.name granted_role
from
( select
t.*, connect_by_root grantee# userid
from
sys.sysauth$ t
connect by
prior privilege# = grantee#
) sa,
sys.user$ u
where
u.user# = sa.privilege#
and sa.userid in
( select
user#
from
sys.user$
where
type# = 1 -- normal users
or user# = 1 -- PUBLIC
)
) t1,
sys.user$ t2
where
t1.userid = t2.user#
)
select
*
from
user_role_hierarchy
where
username = '&user'
order by
granted_role
;