Oracle APEX:内置用户组变量

Oracle APEX: Built-in User Group Variable

我想知道是否有像 :APP_USER 这样的变量,但它应该 return 用户组而不是用户名,所以我可以检查当前用户是否是管理员。

我自己找到了解决方案:

SELECT group_name
FROM   wwv_flow_group_users
WHERE  user_id = (SELECT   user_id
                  FROM     wwv_flow_users
                  WHERE    user_name ='MRITTMAN')

这列出了用户 "MRITTMAN" 分配到的所有组名。

APEX_UTIL 包中包含一些对此也很有用的函数:

CURRENT_USER_IN_GROUP This function returns a Boolean result based on whether the current user is a member of the specified group. You can use the group name or group ID to identify the group.

GET_GROUPS_USER_BELONGS_TO This function returns a comma then a space separated list of group names to which the named user is a member.