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

Establish a connection to the LDAP server

_connect() 

Close connection to source Called on script shutdown

close() 
inherited

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

get_name() 
inherited abstract

Set internal list page

set_page($page) 
inherited
access

public

Arguments

$page

Set internal page size

set_pagesize($size) 
inherited
access

public

Arguments

$size

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

Save a search string for future listings

set_search_set($filter) 
inherited abstract

Arguments

$filter

Getter for saved search properties

get_search_set() : mixed
inherited abstract

Response

mixed

Search properties used by this class

Reset saved results and search parameters

reset() 
inherited abstract

List the current set of contact records

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

Arguments

$cols

$subset

Response

array

Indexed list of contact records, each a hash array

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

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

Callback for sorting entries

_entry_sort_cmp($a, $b) 

Arguments

$a

$b

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'

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

Get a specific contact record

get_record($id, $assoc = false) : mixed
inherited abstract

Arguments

$id

$assoc

Response

mixed

Result object with all record fields or False if not found

Check the given data before saving.

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

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

Arguments

$save_data

$autofix

Response

boolean

True if input is valid, False if not.

Create a new contact record

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

Arguments

$save_data

$check

Response

mixed

The created record ID on success, False on error

Update a specific contact record

update($id, $save_cols) : mixed
inherited

Arguments

$id

$save_cols

Response

mixed

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

Mark one or more contact records as deleted

delete($ids, $force = true) 
inherited

Arguments

$ids

$force

Mark all records in database as deleted

delete_all(bool $with_groups = false) 
inherited

Arguments

$with_groups

bool

Remove also groups

Generate missing attributes as configured

add_autovalues(&$attrs) 

Arguments

$attrs

Converts LDAP entry into an array

_ldap2result($rec) 

Arguments

$rec

Return LDAP attribute(s) for the given field

_map_field($field) 

Arguments

$field

Convert a record data set into LDAP field attributes

_map_data($save_cols) 

Arguments

$save_cols

Returns unified attribute name (resolving aliases)

_attr_name($namev) 
static

Arguments

$namev

Determines whether the given LDAP entry is a group record

is_group_entry($entry) 

Arguments

$entry

Prints debug info to the log

_debug($str) 

Arguments

$str

Activate/deactivate debug mode

set_debug(boolean $dbg = true) 

Arguments

$dbg

boolean

True if LDAP commands should be logged

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

set_group($gid) 
inherited

Arguments

$gid

List all active contact groups of this source

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

Arguments

$search

$mode

Response

array

Indexed list of contact groups, each a hash array

Fetch groups from server

_fetch_groups($vlv_page = null) 

Arguments

$vlv_page

Fetch a group entry from LDAP and save in local cache

get_group_entry($group_id) 

Arguments

$group_id

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

get_group($group_id) : array
inherited

Arguments

$group_id

Response

array

Group properties as hash array

Create a contact group with the given name

create_group($name) : mixed
inherited

Arguments

$name

Response

mixed

False on error, array with record props in success

Delete the given group and all linked group members

delete_group($gid) : boolean
inherited

Arguments

$gid

Response

boolean

True on success, false if no data was changed

Rename a specific contact group

rename_group($gid, $newname, &$newid) : boolean
inherited

Arguments

$gid

$newname

$newid

Response

boolean

New name on success, false if no data was changed

Add the given contact records the a certain group

add_to_group($group_id, $ids) : int
inherited

Arguments

$group_id

$ids

Response

int

Number of contacts added

Remove the given contact records from a certain group

remove_from_group($group_id, $ids) : int
inherited

Arguments

$group_id

$ids

Response

int

Number of deleted group members

Get group assignments of a specific contact record

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

Arguments

$id

Response

array

List of assigned groups as ID=>Name pairs

Detects group member attribute name

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

Arguments

$object_classes

$default

HTML-safe DN string encoding

dn_encode(string $str) : string
static

Arguments

$str

string

DN string

Response

string

Encoded HTML identifier string

Decodes DN string encoded with _dn_encode()

dn_decode(string $str) : string
static

Arguments

$str

string

Encoded HTML identifier string

Response

string

DN string

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

Setter for errors for internal use

set_error($type, $message) 
inherited

Arguments

$type

$message

Create new contact records for every item in the record set

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

Arguments

$recset

$check

Response

array

List of created record IDs

Unmark delete flag on contact record(s)

undelete($ids) 
inherited

Arguments

$ids

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

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

Arguments

$col

$data

$flat

Response

array

List of column values

Normalize the given string for fulltext search.

normalize_string($str) : string
inherited static

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

deprecated

since 0.9-beta

Arguments

$str

Response

string

Normalized string

Compose a valid display name from the given structured contact data

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

Arguments

$contact

$full_email

Response

string

Display name

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

compose_list_name($contact) : string
inherited static

This respects the settings parameter how to list conacts.

Arguments

$contact

Response

string

List name

Create a unique key for sorting contacts

compose_contact_key($contact, $sort_col) 
inherited static

Arguments

$contact

$sort_col

Compare search value with contact data

compare_search_value(string $colname, string|array $value, string $search, int $mode) : bool
inherited

Arguments

$colname

string

Data name

$value

string|array

Data value

$search

string

Search value

$mode

int

Search mode

Response

bool

Comparision result

Constants

constants for error reporting *

ERROR_READ_ONLY
inherited

ERROR_NO_CONNECTION

ERROR_NO_CONNECTION
inherited

ERROR_VALIDATE

ERROR_VALIDATE
inherited

ERROR_SAVING

ERROR_SAVING
inherited

Properties

public properties (mandatory)

primary_key : 
inherited

groups

groups : 
inherited

readonly

readonly : 
inherited

ready

ready : 
inherited

group_id

group_id : 
inherited

coltypes

coltypes : 
inherited

export_groups

export_groups : 
inherited

ldap

ldap : 

prop

prop : 

fieldmap

fieldmap : 

filter

filter : 

sub_filter

sub_filter : 

result

result : 

ldap_result

ldap_result : 

mail_domain

mail_domain : 

debug

debug : 

Group objectclass (lowercase) to member attribute mapping

group_types : array
var

Type(s)

array

base_dn

base_dn : 

groups_base_dn

groups_base_dn : 

group_url

group_url : 

cache

cache : 

searchonly

searchonly : 
inherited

undelete

undelete : 
inherited

list_page

list_page : 
inherited

page_size

page_size : 
inherited

sort_col

sort_col : 
inherited

sort_order

sort_order : 
inherited

date_cols

date_cols : 
inherited

error

error : 
inherited