HAS_USER_ROLE Function
This function returns TRUE
if, the user is assigned to the specified role.
Syntax
APEX_ACL.HAS_USER_ROLE (
p_application_id in number default wwv_flow_security.g_flow_id,
p_user_name in varchar2 default wwv_flow.g_user,
p_role_static_id in varchar2 )
return boolean;
Parameters
Table 2-4 HAS_USER_ROLE Function Parameters
Parameter | Description |
---|---|
|
The application ID for which you want to check if a user is assigned to the specific role. Defaults to the current application. |
|
The case insensitive name of the application user to check. It defaults to the current logged in user. |
|
The case insensitive name of the role static ID. |
Example
The following example shows how to use HAS_USER_ROLE
function to check if the user name called 'SCOTT'
is assigned to role static IDs of 'ADMINISTRATOR'
in application 255
.
declare
l_is_admin boolean := false;
begin
l_is_admin := APEX_ACL.HAS_USER_ROLE (
p_application_id => 255,
p_user_name => 'SCOTT',
p_role_static_id => 'ADMINISTRATOR' );
if not l_is_admin then
raise_application_error(-20001, 'Scott is NOT an administrator' );
end if;
end;
Parent topic: APEX_ACL