rcube_ldap_generic

Model class to access an LDAP directories

package

Framework

subpackage

LDAP

Methods

Object constructor

__construct(array $p) 

Arguments

$p

array

LDAP connection properties

Activate/deactivate debug mode

set_debug(boolean $dbg = true) 

Arguments

$dbg

boolean

True if LDAP commands should be logged

Set connection options

set_config(mixed $opt, mixed $val = null) 

Arguments

$opt

mixed

Option name as string or hash array with multiple options

$val

mixed

Option value

Enable caching by passing an instance of rcube_cache to be used by this object

set_cache($cache_engine) 

Arguments

$cache_engine

Set properties for VLV-based paging

set_vlv_page(\number $page, \number $size = 10) 

Arguments

$page

\number

Page number to list (starting at 1)

$size

\number

Number of entries to display on one page

Establish a connection to the LDAP server

connect($host = null) 

Arguments

$host

Bind connection with (SASL-) user and password

sasl_bind(string $authc, string $pass, string $authz = null) : boolean

Arguments

$authc

string

Authentication user

$pass

string

Bind password

$authz

string

Autorization user

Response

boolean

True on success, False on error

Bind connection with DN and password

bind(string $dn, string $pass) : boolean

Arguments

$dn

string

Bind DN

$pass

string

Bind password

Response

boolean

True on success, False on error

Close connection to LDAP server

close() 

Return the last result set

get_result() : object

Response

object

rcube_ldap_result Result object

Get a specific LDAP entry, identified by its DN

get_entry(string $dn) : array

Arguments

$dn

string

Record identifier

Response

array

Hash array

Modify an LDAP entry on the server

modify(string $dn, $parms, int $mode = 255) 

Arguments

$dn

string

Entry DN

$parms

$mode

int

Update mode (UPDATE_MOD_ADD | UPDATE_MOD_DELETE | UPDATE_MOD_REPLACE)

Wrapper for ldap_add()

add($dn, $entry) 
see \ldap_add()

Arguments

$dn

$entry

Wrapper for ldap_delete()

delete($dn) 
see \ldap_delete()

Arguments

$dn

Wrapper for ldap_mod_replace()

mod_replace($dn, $entry) 
see \ldap_mod_replace()

Arguments

$dn

$entry

Wrapper for ldap_mod_add()

mod_add($dn, $entry) 
see \ldap_mod_add()

Arguments

$dn

$entry

Wrapper for ldap_mod_del()

mod_del($dn, $entry) 
see \ldap_mod_del()

Arguments

$dn

$entry

Wrapper for ldap_rename()

rename($dn, $newrdn, $newparent = null, $deleteoldrdn = true) 
see \ldap_rename()

Arguments

$dn

$newrdn

$newparent

$deleteoldrdn

Wrapper for ldap_list() + ldap_get_entries()

list_entries($dn, $filter, $attributes = array('dn')) 
see \ldap_list() \ldap_get_entries()

Arguments

$dn

$filter

$attributes

Wrapper for ldap_read() + ldap_get_entries()

read_entries($dn, $filter, $attributes = null) 
see \ldap_read() \ldap_get_entries()

Arguments

$dn

$filter

$attributes

Choose the right PHP function according to scope property

scope2func(string $scope, string &$ns_function = null) : string
static

Arguments

$scope

string

The LDAP scope (sub|base|list)

$ns_function

string

Function to be used for numSubOrdinates queries

Response

string

PHP function to be used to query directory

Convert the given scope integer value to a string representation

scopeint2str($scope) 
static

Arguments

$scope

Escapes the given value according to RFC 2254 so that it can be safely used in LDAP filters.

escape_value(string $val) : string
static

Arguments

$val

string

Value to quote

Response

string

The escaped value

Escapes a DN value according to RFC 2253

escape_dn(string $dn) : string
static

Arguments

$dn

string

DN value o quote

Response

string

The escaped value

Normalize a LDAP result by converting entry attributes arrays into single values

normalize_result(array $result) : array
static

Arguments

$result

array

LDAP result set fetched with ldap_get_entries()

Response

array

Hash array with normalized entries, indexed by their DNs

Turn an LDAP entry into a regular PHP array with attributes as keys.

normalize_entry(array $entry) : array
static

Arguments

$entry

array

Attributes array as retrieved from ldap_get_attributes() or ldap_get_entries()

Response

array

Hash array with attributes as keys

Set server controls for Virtual List View (paginated listing)

_vlv_set_controls($sort, $list_page, $page_size, $search = null) 

Arguments

$sort

$list_page

$page_size

$search

Returns unified attribute name (resolving aliases)

_attr_name($namev) 
static

Arguments

$namev

Quotes attribute value string

quote_string(string $str, bool $dn = false) : string
static

Arguments

$str

string

Attribute value

$dn

bool

True if the attribute is a DN

Response

string

Quoted string

Prints debug info to the log

_debug($str) 

Arguments

$str

Find a VLV index matching the given query attributes

_find_vlv($base_dn, $filter, $scope, $sort_attrs = null) : string

Arguments

$base_dn

$filter

$scope

$sort_attrs

Response

string

Sort attribute or False if no match

Return VLV indexes and searches including necessary configuration details.

_read_vlv_config() 

Generate BER encoded string for Virtual List View option

_vlv_ber_encode($offset, $rpp, $search = '') : string
static

Arguments

$offset

$rpp

$search

Response

string

BER encoded option value

create ber encoding for sort control

_sort_ber_encode($sortcols) : string
static

Arguments

$sortcols

Response

string

BER encoded option value

Add BER sequence with correct length and the given identifier

_ber_addseq($str, $identifier) 
static

Arguments

$str

$identifier

Returns BER encoded integer value in hex format

_ber_encode_int($offset) 
static

Arguments

$offset

Returns ascii string encoded in hex

_string2hex($str) 
static

Arguments

$str

Constants

UPDATE_MOD_ADD

UPDATE_MOD_ADD

UPDATE_MOD_DELETE

UPDATE_MOD_DELETE

UPDATE_MOD_REPLACE

UPDATE_MOD_REPLACE

UPDATE_MOD_FULL

UPDATE_MOD_FULL

Properties

conn

conn : 

vlv_active

vlv_active : 

private properties

cache : 

config

config : 

attributes

attributes : 

entries

entries : 

result

result : 

debug

debug : 

list_page

list_page : 

page_size

page_size : 

vlv_config

vlv_config :