2.5 IS_ROLE_REMOVED_FROM_USER Function

This function checks if a role is removed from a user. This function returns TRUE if a specific role is removed from the list of new role IDs for the user.

Syntax

APEX_ACL.IS_ROLE_REMOVED_FROM_USER (
    p_application_id    IN NUMBER       DEFAULT apex_application.g_flow_id,
    p_user_name         IN VARCHAR2,
    p_role_static_id    IN VARCHAR2,
    p_role_ids          IN apex_t_number )
    RETURN BOOLEAN;

Parameters

Table 2-5 IS_ROLE_REMOVED_FROM_USER Parameters

Parameter Description
p_application_id The application ID for which you want to check if specific role removed from the list of roles from a user. It defaults to the current application.
p_user_name The case insensitive name of the application user to check.
p_role_static_id The case insensitive name of the role static ID to check if it is removed.
p_role_ids The array of NUMBER type new role IDs the user is assigned to.

Example

The following example uses the IS_ROLE_REMOVED_FROM_USER function to check if role static ID of ADMINISTRATOR is removed from the new role IDs of 2505704029884282, 345029884282 for user name SCOTT in application 255.

DECLARE
    is_role_removed boolean := false;
BEGIN
    is_role_removed := apex_acl.is_role_removed_from_user (
                         p_application_id => 255,
                         p_user_name => 'SCOTT',
                         p_role_static_id => 'ADMINISTRATOR',
                         p_role_ids => apex_t_number( 2505704029884282, 345029884282 ) );

    IF NOT is_role_removed THEN
        raise_application_error(-20001, 'ADMINISTRATOR role is not removed from SCOTT.' );
    END IF;
END;