rcube_ldap

Extends \rcube_addressbook

Model class to access an LDAP address directory

package

Framework

subpackage

Addressbook

Methods

Object constructor

__construct(array $p, boolean $debug = false, string $mail_domain = null) 

Arguments

$p

array

LDAP connection properties

$debug

boolean

Enables debug mode

$mail_domain

string

Current user mail domain name

Returns unified attribute name (resolving aliases)

_attr_name( $namev) 
static

Arguments

$namev

Establish a connection to the LDAP server

_connect() 

Callback for sorting entries

_entry_sort_cmp( $a,  $b) 

Arguments

$a

$b

Fetch groups from server

_fetch_groups( $search = null,  $mode,  $vlv_page = null) 

Arguments

$search

$mode

$vlv_page

Converts LDAP entry into an array

_ldap2result( $rec) 

Arguments

$rec

Fetch members of the given group entry from server

_list_group_members( $dn,  $entry,  $attr,  $count) : array

Arguments

$dn

$entry

$attr

$count

Response

array

Accumulated group members

List members of group class groupOfUrls

_list_group_memberurl( $dn,  $entry,  $count) : array

Arguments

$dn

$entry

$count

Response

array

Accumulated group members

Convert a record data set into LDAP field attributes

_map_data( $save_cols) 

Arguments

$save_cols

Return LDAP attribute(s) for the given field

_map_field( $field) 

Arguments

$field

Generate missing attributes as configured

add_autovalues( &$attrs) 

Arguments

$attrs

Add the given contact records the a certain group

add_to_group(string $group_id, array|string $ids) : integer
inherited

Arguments

$group_id

string

Group identifier

$ids

array|string

List of contact identifiers to be added

Response

integer

Number of contacts added

Close connection to source Called on script shutdown

close() 
inherited

Compare search value with contact data

compare_search_value(string $colname, string|array $value, string $search, integer $mode) : boolean
inherited

Arguments

$colname

string

Data name

$value

string|array

Data value

$search

string

Search value

$mode

integer

Search mode

Response

boolean

Comparison result

Create a unique key for sorting contacts

compose_contact_key(array $contact, string $sort_col) : string
inherited static

Arguments

$contact

array

Contact record

$sort_col

string

Sorting column name

Response

string

Unique key

Compose a valid display name from the given structured contact data

compose_display_name(array $contact, boolean $full_email = false) : string
inherited static

Arguments

$contact

array

Hash array with contact data as key-value pairs

$full_email

boolean

Don't attempt to extract components from the email address

Response

string

Display name

Compose the name to display in the contacts list for the given contact record.

compose_list_name(array $contact) : string
inherited static

This respects the settings parameter how to list conacts.

Arguments

$contact

array

Hash array with contact data as key-value pairs

Response

string

List name

Build contact display name for autocomplete listing

compose_search_name(array $contact, string $email = null, string $name = null, string $templ = null) : string
inherited static

Arguments

$contact

array

Hash array with contact data as key-value pairs

$email

string

Optional email address

$name

string

Optional name (self::compose_list_name() result)

$templ

string

Optional template to use (defaults to the 'contact_search_name' config option)

Response

string

Display name

Count number of available contacts in database

count() : \rcube_result_set
inherited abstract

Response

\rcube_result_set

Result set with values for 'count' and 'first'

Create a contact group with the given name

create_group(string $name) : mixed
inherited

Arguments

$name

string

The group name

Response

mixed

False on error, array with record props in success

Mark one or more contact records as deleted

delete(array $ids, boolean $force = true) 
inherited

Arguments

$ids

array

Record identifiers

$force

boolean

Remove records irreversible (see self::undelete)

Mark all records in database as deleted

delete_all(boolean $with_groups = false) 
inherited

Arguments

$with_groups

boolean

Remove also groups

Delete the given group and all linked group members

delete_group(string $group_id) : boolean
inherited

Arguments

$group_id

string

Group identifier

Response

boolean

True on success, false if no data was changed

Decodes DN string encoded with _dn_encode()

dn_decode(string $str) : string
static

Arguments

$str

string

Encoded HTML identifier string

Response

string

DN string

HTML-safe DN string encoding

dn_encode(string $str) : string
static

Arguments

$str

string

DN string

Response

string

Encoded HTML identifier string

Utility function to return all values of a certain data column either as flat list or grouped by subtype

get_col_values(string $col, array $data, boolean $flat = false) : array
inherited static

Arguments

$col

string

Col name

$data

array

Record data array as used for saving

$flat

boolean

True to return one array with all values, False for hash array with values grouped by type

Response

array

List of column values

Returns the last error occurred (e.g. when updating/inserting failed)

get_error() : array
inherited

Response

array

Hash array with the following fields: type, message

Get group properties such as name and email address(es)

get_group(string $group_id) : array
inherited

Arguments

$group_id

string

Group identifier

Response

array

Group properties as hash array

Fetch a group entry from LDAP and save in local cache

get_group_entry( $group_id) 

Arguments

$group_id

Detects group member attribute name

get_group_member_attr( $object_classes = array(),  $default = 'member') 

Arguments

$object_classes

$default

Returns addressbook name (e.g. for addressbooks listing)

get_name() 
inherited abstract

Get a specific contact record

get_record(mixed $id, boolean $assoc = false) : \rcube_result_set|array
inherited abstract

Arguments

$id

mixed

Record identifier(s)

$assoc

boolean

True to return record as associative array, otherwise a result set is returned

Response

\rcube_result_set|array

Result object with all record fields

Get group assignments of a specific contact record

get_record_groups( $id) : array
inherited
since 0.5-beta

Arguments

$id

Response

array

$id List of assigned groups as ID=>Name pairs

Return the last result set

get_result() : \rcube_result_set
inherited abstract

Response

\rcube_result_set

Current result set or NULL if nothing selected yet

Getter for saved search properties

get_search_set() : mixed
inherited abstract

Response

mixed

Search properties used by this class

Create a new contact record

insert(array $save_data, boolean $check = false) : mixed
inherited

Arguments

$save_data

array

Associative array with save data Keys: Field name with optional section in the form FIELD:SECTION Values: Field value. Can be either a string or an array of strings for multiple values

$check

boolean

True to check for duplicates first

Response

mixed

The created record ID on success, False on error

Create new contact records for every item in the record set

insertMultiple(\rcube_result_set $recset, boolean $check = false) : array
inherited

Arguments

$recset

\rcube_result_set

Recordset to insert

$check

boolean

True to check for duplicates first

Response

array

List of created record IDs

Determines whether the given LDAP entry is a group record

is_group_entry( $entry) 

Arguments

$entry

Get all members of the given group

list_group_members( $dn,  $count = false,  $entries = null) : array

Arguments

$dn

$count

$entries

Response

array

Accumulated group members

List all active contact groups of this source

list_groups(string $search = null, integer $mode) : array
inherited

Arguments

$search

string

Optional search string to match group name

$mode

integer

Search mode. Sum of self::SEARCH_*

Response

array

Indexed list of contact groups, each a hash array

List the current set of contact records

list_records(array $cols = null, integer $subset) : array
inherited abstract

Arguments

$cols

array

List of cols to show

$subset

integer

Only return this number of records, use negative values for tail

Response

array

Indexed list of contact records, each a hash array

Normalize the given string for fulltext search.

normalize_string(string $str) : string
inherited static

Currently only optimized for Latin-1 characters; to be extended

deprecated

since 0.9-beta

Arguments

$str

string

Input string (UTF-8)

Response

string

Normalized string

Remove the given contact records from a certain group

remove_from_group(string $group_id, array|string $ids) : integer
inherited

Arguments

$group_id

string

Group identifier

$ids

array|string

List of contact identifiers to be removed

Response

integer

Number of deleted group members

Rename a specific contact group

rename_group(string $group_id, string $newname,  &$newid) : boolean
inherited

Arguments

$group_id

string

Group identifier

$newname

string

New name to set for this group

$newid

Response

boolean

New name on success, false if no data was changed

Reset saved results and search parameters

reset() 
inherited abstract

Activate/deactivate debug mode

set_debug(boolean $dbg = true) 

Arguments

$dbg

boolean

True if LDAP commands should be logged

Setter for errors for internal use

set_error(integer $type, string $message) 
inherited

Arguments

$type

integer

Error type (one of this class' error constants)

$message

string

Error message (name of a text label)

Setter for the current group (empty, has to be re-implemented by extending class)

set_group( $group_id) 
inherited

Arguments

$group_id

Set internal list page

set_page(\number $page) 
inherited

Arguments

$page

\number

Page number to list

Set internal page size

set_pagesize(\number $size) 
inherited

Arguments

$size

\number

Number of messages to display on one page

Save a search string for future listings

set_search_set(mixed $filter) 
inherited abstract

Arguments

$filter

mixed

Search params to use in listing method, obtained by get_search_set()

Set internal sort settings

set_sort_order(string $sort_col, string $sort_order = null) 
inherited

Arguments

$sort_col

string

Sort column

$sort_order

string

Sort order

Unmark delete flag on contact record(s)

undelete(array $ids) 
inherited

Arguments

$ids

array

Record identifiers

Update a specific contact record

update(mixed $id, array $save_cols) : mixed
inherited

Arguments

$id

mixed

Record identifier

$save_cols

array

Associative array with save data Keys: Field name with optional section in the form FIELD:SECTION Values: Field value. Can be either a string or an array of strings for multiple values

Response

mixed

On success if ID has been changed returns ID, otherwise True, False on error

Check the given data before saving.

validate( &$save_data, boolean $autofix = false) : boolean
inherited

If input isn't valid, the message to display can be fetched using get_error()

Arguments

$save_data

$autofix

boolean

Attempt to fix/complete record automatically

Response

boolean

True if input is valid, False if not.

Constants

ERROR_READ_ONLY

ERROR_READ_ONLY
inherited

ERROR_NO_CONNECTION

ERROR_NO_CONNECTION
inherited

ERROR_VALIDATE

ERROR_VALIDATE
inherited

ERROR_SAVING

ERROR_SAVING
inherited

SEARCH_ALL

SEARCH_ALL
inherited

SEARCH_STRICT

SEARCH_STRICT
inherited

SEARCH_PREFIX

SEARCH_PREFIX
inherited

SEARCH_GROUPS

SEARCH_GROUPS
inherited

Properties

primary_key

primary_key : 
inherited

Type(s)

groups

groups : 
inherited

Type(s)

readonly

readonly : 
inherited

Type(s)

ready

ready : 
inherited

Type(s)

group_id

group_id : 
inherited

Type(s)

coltypes

coltypes : 
inherited

Type(s)

export_groups

export_groups : 
inherited

Type(s)

ldap

ldap : 

Type(s)

formats

formats : 

Type(s)

prop

prop : 

Type(s)

fieldmap

fieldmap : 

Type(s)

filter

filter : 

Type(s)

sub_filter

sub_filter : 

Type(s)

result

result : 

Type(s)

ldap_result

ldap_result : 

Type(s)

mail_domain

mail_domain : 

Type(s)

debug

debug : 

Type(s)

Group objectclass (lowercase) to member attribute mapping

group_types : array
var

Type(s)

array

base_dn

base_dn : 

Type(s)

groups_base_dn

groups_base_dn : 

Type(s)

group_data

group_data : 

Type(s)

group_search_cache

group_search_cache : 

Type(s)

cache

cache : 

Type(s)

searchonly

searchonly : 
inherited

Type(s)

undelete

undelete : 
inherited

Type(s)

list_page

list_page : 
inherited

Type(s)

page_size

page_size : 
inherited

Type(s)

sort_col

sort_col : 
inherited

Type(s)

sort_order

sort_order : 
inherited

Type(s)

date_cols

date_cols : 
inherited

Type(s)

error

error : 
inherited

Type(s)