32.4 IS_MEMBER Function

This function returns a boolean TRUE if the user named by p_username (with password if required) is a member of the group specified by the p_group and p_group_base parameters using the provided auth base, host, and port.

Syntax

APEX_LDAP.IS_MEMBER (
    p_username              IN VARCHAR2,
    p_pass                  IN VARCHAR2 DEFAULT NULL,
    p_auth_base             IN VARCHAR2,
    p_host                  IN VARCHAR2,
    p_port                  IN VARCHAR2 DEFAULT 389,
    p_use_ssl               IN VARCHAR2 DEFAULT 'N',
    p_group                 IN VARCHAR2,
    p_group_base            IN VARCHAR2,
    p_credential_static_id  IN VARCHAR2 DEFAULT NULL );
RETURN BOOLEAN;

Parameters

Table 32-4 IS_MEMBER Parameters

Parameter Description
p_username Login name of the user.
p_pass Password for p_username.
p_auth_base LDAP search base, for example, dc=users,dc=my,dc=org.
p_host LDAP server host name.
p_port LDAP server port number.
p_use_ssl

(Default) Set to N to not use SSL.

Set to Y to use SSL in bind to LDAP server.

Set to A to use SSL with one-way authentication (requires LDAP server certificate configured in an Oracle wallet).

p_group Name of the group to be search for membership.
p_group_base The base from which the search should be started.
p_credential_static_id

The credential static ID (can be NULL for anonymous or username/pass binds).

If it is not NULL and the credential could not be found, then raises the error no_data_found.

Example

The following example demonstrates how to use the APEX_LDAP.IS_MEMBER function to verify whether a user is a member of a group against an LDAP server.

DECLARE
    L_VAL boolean;
BEGIN
    L_VAL := APEX_LDAP.IS_MEMBER(
        p_username =>'firstname.lastname',
        p_pass =>'abcdef',
        p_auth_base => 'cn=user,l=amer,dc=my_company,dc=com',
        p_host => 'our_ldap_sever.my_company.com',
        p_port => '636',
        p_use_ssl => 'A',
        p_group => 'group_name',
        p_group_base => 'group_base');
    IF L_VAL THEN
        htp.p('Is a member.');
    ELSE
        htp.p('Not a member.');
    END IF;
END;