1.3 HAS_USER_ANY_ROLES Function

This function returns TRUE if, the user is assigned to any application role. This function can be used to check if a user is allowed to access an application.

Syntax

APEX_ACL.HAS_USER_ANY_ROLES (
    p_application_id IN NUMBER   DEFAULT apex_application.g_flow_id,
    p_user_name      IN VARCHAR2 DEFAULT apex_application.g_user )
    return boolean;

Parameters

Table 1-3 HAS_USER_ANY_ROLES Function Parameters

Parameter Description

p_application_id

The application ID for which you want to check if a user is assigned to any application role. It defaults to the current application.

p_user_name

The case insensitive name of the application user to check. Defaults to the current logged in user.

Example

The following example shows how to use HAS_USER_ANY_ROLES function to check if the user name called 'SCOTT' is assigned to any application role in application 255.

begin
    return APEX_ACL.HAS_USER_ANY_ROLES (
            p_application_id  => 255,
            p_user_name       => 'SCOTT' );
end;