Functions

The LDAP class indicating a group.

get_group_class() : string

Returns

stringThe property.

The LDAP group that maps to the first administrative group in ocPortal (db_get_first_id()+1).

get_mapped_admin_group() : string

Returns

stringThe group.

The LDAP group that maps to the default ocPortal group.

get_mapped_users_group() : string

Returns

stringThe group.

The LDAP class indicating an account.

get_member_class() : string

Returns

stringThe property.

The group naming property LDAP will be using.

group_property() : string

Returns

stringThe property.

Where in the LDAP hierarchy to search for members.

group_search_qualifier() : string

Returns

stringThe property.

Standard code module initialisation function.

init__ocf_ldap() 

Escape, ready for an LDAP query.

ldap_escape(string $str, boolean $for_dn) : string

Parameters

$str

string

The value.

$for_dn

boolean

Whether this is for use in a DN string.

Returns

stringThe escaped value.

Unescape data from LDAP.

ldap_unescape(string $str) : string

Technically this is not unescaping, it's just a character set conversion, but function is named to provide symmetry with ldap_escape which does both escaping and character set conversion.

Parameters

$str

string

The escaped value.

Returns

stringThe value.

The property in LDAP used for logins.

member_property() : string

Returns

stringThe property.

Where in the LDAP hierarchy to search for groups.

member_search_qualifier() : string

Returns

stringThe property.

Get a list of usergroups on the LDAP server.

ocf_get_all_ldap_groups() : array

Returns

arrayThe list of user-groups (string).

(LDAP helper for ocf_get_group_members_raw) Get a list of members in a group (or more full details if $non_validated is true).

ocf_get_group_members_raw_ldap(array $members, \GROUP $group_id, boolean $include_primaries, boolean $non_validated, boolean $include_secondaries) 

Parameters

$members

array

The list is written into this.

$group_id

\GROUP

The ID of the usergroup.

$include_primaries

boolean

Whether to include those in the usergroup as a primary member.

$non_validated

boolean

Whether to include those applied to join the usergroup, but not validated in.

$include_secondaries

boolean

Whether to include those in the usergroup as a secondary member.

Find the LDAP servers password for a certain member.

ocf_get_ldap_hash(string $cn) : \?string

Parameters

$cn

string

The username.

Returns

\?stringThe password (NULL: no such user).

(LDAP helper for ocf_get_members_groups) Get a list of the usergroups a member is in (keys say the usergroups, values are irrelevant).

ocf_get_members_groups_ldap(\?MEMBER $member_id) : array

Parameters

$member_id

\?MEMBER

The member to find the usergroups of (NULL: current member).

Returns

arrayThe list (e.g. array(1=>1,2=>1,3=>1) for someone in (1,2,3)). The keys are all that matters, values are arbitrary.

Find the LDAP ID for a named LDAP usergroup.

ocf_group_ldapcn_to_ldapgid(string $cn) : \?integer

POSIX Only.

Parameters

$cn

string

The named LDAP usergroup.

Returns

\?integerThe LDAP usergroup ID (NULL: none).

Find the ocPortal-ID for a named LDAP usergroup.

ocf_group_ldapcn_to_ocfid(string $cn) : \?GROUP

Parameters

$cn

string

The usergroup.

Returns

\?GROUPThe ocPortal-ID (NULL: none).

Find the ocPortal-ID for an LDAP usergroup-ID.

ocf_group_ldapgid_to_ocfid(integer $gid) : \?GROUP

POSIX Only.

Parameters

$gid

integer

The LDAP ID.

Returns

\?GROUPThe ocPortal-ID (NULL: could not find).

Find the named LDAP usergroup for an OCF ID.

ocf_group_ocfid_to_ldapcn(\GROUP $id) : \?SHORT_TEXT

Note that the returned MAY NOT ACTUALLY EXIST!

Parameters

$id

\GROUP

The OCF ID.

Returns

\?SHORT_TEXTThe named LDAP usergroup (NULL: none).

Find whether a member of a certain username WOULD be bound to LDAP authentication (an exceptional situation, only for sites that use it).

ocf_is_ldap_member_potential(string $cn) : boolean

Parameters

$cn

string

The username.

Returns

booleanThe answer.

Find whether a member exists on the LDAP server.

ocf_is_on_ldap(\SHORT_TEXT $cn) : boolean

Parameters

$cn

\SHORT_TEXT

The username.

Returns

booleanThe answer.

Performs the OCF LDAP connection bind, used to do general querying (not a user login).

ocf_ldap_bind() 

Set up the OCF LDAP connection.

ocf_ldap_connect() 

Get the primary usergroup of a member in LDAP.

ocf_ldap_get_member_primary_group(\MEMBER $member_id) : \GROUP

Parameters

$member_id

\MEMBER

The member.

Returns

\GROUPThe.

Get the e-mail of a member in LDAP.

ocf_ldap_guess_email(\ID_TEXT $cn) : \SHORT_TEXT

Parameters

$cn

\ID_TEXT

The CN of the member.

Returns

\SHORT_TEXTGuessed e-mail address (blank: couldn't find).

Convert a plain-text password into a hashed password.

ocf_ldap_hash(string $cn, string $password) : string

Parameters

$cn

string

The username (we use this to extract the hash algorithm being used by the member).

$password

string

The password.

Returns

stringThe hashed password.

Converts an active directory style long-CN to a short one.

ocf_long_cn_to_short_cn(string $long, string $type) : string

Parameters

$long

string

The long one.

$type

string

The type (e.g. CN, DN).

Returns

stringThe short one.

Find the ocPortal member-ID for an LDAP username.

ocf_member_ldapcn_to_ocfid(string $cn) : \?integer

Parameters

$cn

string

The username.

Returns

\?integerThe ocPortal member-ID (NULL: none).

Find the LDAP username for an ocPortal member-ID.

ocf_member_ocfid_to_ldapcn(integer $id) : \?SHORT_TEXT

Parameters

$id

integer

The ocPortal member-ID.

Returns

\?SHORT_TEXTThe username (NULL: none).

Constants

 

LDAP_OPT_DIAGNOSTIC_MESSAGE

LDAP_OPT_DIAGNOSTIC_MESSAGE