Object encapsulation of the resource(ldap link) native object

package Ldap-Core

 Methods

Magic method to provide read() and list() methods

__call(string $method, array $args) : \Dreamscapes\Ldap\Core\ResultResource

Parameters

$method

string

Method name that was called

$args

array

Arguments with which the method was called

Returns

\Dreamscapes\Ldap\Core\ResultResource

Create a new instance

__construct(string $ldapUrl = null

If $ldapUrl is provided, it will also open connection to the ldap server by calling self::connect().

Parameters

$ldapUrl

string

Optional ldap URI string of the ldap server

Allow resource's string representation to be ldap URI string

__toString() : string

Returns

stringLdap server and port of this connection (i.e. example.com:389)

Add entries to LDAP directory

add(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

An array that specifies the information about the entry

Returns

\Dreamscapes\Ldap\Core\Ldap

Bind to LDAP directory

bind(string $bindDn = null, string $bindPassword = null) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$bindDn

string

Username for the bind

$bindPassword

string

Password for the username

Returns

\Dreamscapes\Ldap\Core\Ldap

Alias of self::unbind()

close() 

Compare value of attribute found in entry specified with DN

compare(string $dn, string $attribute, string $value) : boolean

Parameters

$dn

string

The distinguished name of an LDAP entity

$attribute

string

The attribute name

$value

string

The compared value

Returns

booleanReturns TRUE if value matches otherwise returns FALSE

Open connection to an ldap server

connect(string $ldapUrl) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$ldapUrl

string

Ldap URI string of the ldap server (i.e.

                             ldap://my.server.com:389)

Returns

\Dreamscapes\Ldap\Core\Ldap

Delete an entry from a directory

delete(string $dn) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

Returns

\Dreamscapes\Ldap\Core\Ldap

Convert DN to User Friendly Naming format

dnToUfn(string $dn) : string
Static

Parameters

$dn

string

The distinguished name of an LDAP entity

Returns

stringThe user friendly name

Convert LDAP error number into string error message

errToStr(integer $errno) : string
Static

Parameters

$errno

integer

The error number

Returns

stringThe error message, as a string

Return the LDAP error number of the last LDAP command

errno() : integer

Returns

integer

Return the LDAP error message of the last LDAP command

error() : string

Returns

string

Escape a string for use in an LDAP filter or DN

escape(string $value, string $ignore = null, integer $flags = null) : string
Static

$flags may be one of: Ldap::ESCAPE_FILTER, Ldap::ESCAPE_DN

since PHP 5.6

Parameters

$value

string

The value to escape

$ignore

string

Characters to ignore when escaping

$flags

integer

The context the escaped string will be used in

Returns

stringReturns the escaped string

Splits DN into its component parts

explodeDn(string $dn, integer $withAttrib = 0) : array
Static

Parameters

$dn

string

The distinguished name of an LDAP entity

$withAttrib

integer

Used to request if the RDNs are returned with only values or their attributes as well

Returns

arrayReturns an array of all DN components

Get the current value for given option

getOption(integer $option) : mixed

Parameters

$option

integer

The option to be returned

Returns

mixed

Get the PHP's native ldap resource object

getResource() : resource

Returns

resource(ldap link)

Perform search operation with SCOPE_ONELEVEL - see self::search() for argument list

list() : 
magic
method Perform search operation with SCOPE_ONELEVEL - see self::search() for argument list

Returns

Add attribute values to current attributes

modAdd(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Values to be added to the specified attributes

Returns

\Dreamscapes\Ldap\Core\Ldap

Compatibility alias for self::modDelete()

modDel(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Values to be deleted from the specified attributes

Returns

\Dreamscapes\Ldap\Core\Ldap

Delete attribute values from current attributes

modDelete(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Values to be deleted from the specified attributes

Returns

\Dreamscapes\Ldap\Core\Ldap

Replace attribute values with new ones

modReplace(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Attributes and their values to be replaced

Returns

\Dreamscapes\Ldap\Core\Ldap

Modify an LDAP entry

modify(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Attributes with their modified values

Returns

\Dreamscapes\Ldap\Core\Ldap

Modify an existing entry in the LDAP directory

modifyBatch(string $dn, array $entry) : \Dreamscapes\Ldap\Core\Ldap

Allows detailed specification of the modifications to perform.

Example:

$modifs = array(

array(
    "attrib"  => "telephoneNumber",
    "modtype" => Ldap::MODIFY_BATCH_ADD,
    "values"  => array("+420 777 111 222")
)

); $ldap->modifyBatch("cn=Robert Rossmann,dc=example,dc=com", $modifs);

since PHP ~5.4.26, >=5.5.10
see
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$entry

array

Modification specifications

Returns

\Dreamscapes\Ldap\Core\Ldap

Send LDAP pagination control

pagedResult(integer $pageSize, boolean $isCritical = false, string $cookie = '') : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$pageSize

integer

The number of entries by page

$isCritical

boolean

Indicates whether the pagination is critical of not

$cookie

string

An opaque structure sent by the server

Returns

\Dreamscapes\Ldap\Core\Ldap

Perform search operation with SCOPE_BASE - see self::search() for argument list

read() : 
magic
method Perform search operation with SCOPE_BASE - see self::search() for argument list

Returns

Modify the name of an entry

rename(string $dn, string $newRdn, string $newParent, boolean $deleteOldRdn) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$dn

string

The distinguished name of an LDAP entity

$newRdn

string

The new RDN

$newParent

string

The new parent/superior entry

$deleteOldRdn

boolean

If TRUE the old RDN value(s) are removed, else the old RDN

                         value(s) are retained as non-distinguished values of the entry

Returns

\Dreamscapes\Ldap\Core\Ldap

Bind to LDAP directory using SASL

saslBind(string $bindDn = null, string $bindPassword = null, string $saslMech = null, string $saslRealm = null, string $saslAuthcId = null, string $saslAuthzId = null, string $props = null) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$bindDn

string

$bindPassword

string

$saslMech

string

$saslRealm

string

$saslAuthcId

string

$saslAuthzId

string

$props

string

Returns

\Dreamscapes\Ldap\Core\Ldap

Set the value of the given option

setOption(integer $option, mixed $newVal) 

Parameters

$option

integer

An lDAP option constant

$newVal

mixed

The new value for the option

Compatibility alias of self::setRebindProcedure()

setRebindProc(callable $callback) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$callback

callable

Returns

\Dreamscapes\Ldap\Core\Ldap

Set a callback function to do re-binds on referral chasing

setRebindProcedure(callable $callback) : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Parameters

$callback

callable

Returns

\Dreamscapes\Ldap\Core\Ldap

Start TLS

startTls() : \Dreamscapes\Ldap\Core\Ldap
fluent This method is part of a fluent interface and will return the same instance

Returns

\Dreamscapes\Ldap\Core\Ldap

Unbind from LDAP directory

unbind() : void

Once unbound the instance holding the link resource must not be used any further.

 Constants

     

ADMINLIMIT_EXCEEDED

ADMINLIMIT_EXCEEDED = 11 
 

AFFECTS_MULTIPLE_DSAS

AFFECTS_MULTIPLE_DSAS = 71 
 

ALIAS_DEREF_PROBLEM

ALIAS_DEREF_PROBLEM = 36 
 

ALIAS_PROBLEM

ALIAS_PROBLEM = 33 
 

ALREADY_EXISTS

ALREADY_EXISTS = 68 
 

AUTH_METHOD_NOT_SUPPORTED

AUTH_METHOD_NOT_SUPPORTED = 7 
 

BUSY

BUSY = 51 
 

COMPARE_FALSE

COMPARE_FALSE = 5 
 

COMPARE_TRUE

COMPARE_TRUE = 6 
 

CONFIDENTIALITY_REQUIRED

CONFIDENTIALITY_REQUIRED = 13 
 

CONSTRAINT_VIOLATION

CONSTRAINT_VIOLATION = 19 
 

ERROR_TOO_MANY_CONTEXT_IDS

ERROR_TOO_MANY_CONTEXT_IDS = 49 
 

ESCAPE_DN

ESCAPE_DN = LDAP_ESCAPE_DN 
 

ESCAPE_FILTER

ESCAPE_FILTER = LDAP_ESCAPE_FILTER 
 

INAPPROPRIATE_AUTH

INAPPROPRIATE_AUTH = 48 
 

INAPPROPRIATE_MATCHING

INAPPROPRIATE_MATCHING = 18 
 

INSUFFICIENT_ACCESS

INSUFFICIENT_ACCESS = 50 
 

INVALID_CREDENTIALS

INVALID_CREDENTIALS = 49 
 

INVALID_DN_SYNTAX

INVALID_DN_SYNTAX = 34 
 

INVALID_SYNTAX

INVALID_SYNTAX = 21 
 

IS_LEAF

IS_LEAF = 35 
 

LOOP_DETECT

LOOP_DETECT = 54 
 

MODIFY_BATCH_ADD

MODIFY_BATCH_ADD = LDAP_MODIFY_BATCH_ADD 
 

MODIFY_BATCH_REMOVE

MODIFY_BATCH_REMOVE = LDAP_MODIFY_BATCH_REMOVE 
 

MODIFY_BATCH_REMOVE_ALL

MODIFY_BATCH_REMOVE_ALL = LDAP_MODIFY_BATCH_REMOVE_ALL 
 

MODIFY_BATCH_REPLACE

MODIFY_BATCH_REPLACE = LDAP_MODIFY_BATCH_REPLACE 
 

NAMING_VIOLATION

NAMING_VIOLATION = 64 
 

NOT_ALLOWED_ON_NONLEAF

NOT_ALLOWED_ON_NONLEAF = 66 
 

NOT_ALLOWED_ON_RDN

NOT_ALLOWED_ON_RDN = 67 
 

NOT_PERMITTED_TO_LOGON_AT_THIS_TIME

NOT_PERMITTED_TO_LOGON_AT_THIS_TIME = 530 
 

NO_OBJECT_CLASS_MODS

NO_OBJECT_CLASS_MODS = 69 
 

NO_SUCH_ATTRIBUTE

NO_SUCH_ATTRIBUTE = 16 
 

NO_SUCH_OBJECT

NO_SUCH_OBJECT = 32 
 

OBJECT_CLASS_VIOLATION

OBJECT_CLASS_VIOLATION = 65 
 

OPERATIONS_ERROR

OPERATIONS_ERROR = 1 
 

OPT_CLIENT_CONTROLS

OPT_CLIENT_CONTROLS = LDAP_OPT_CLIENT_CONTROLS 
 

OPT_DEBUG_LEVEL

OPT_DEBUG_LEVEL = LDAP_OPT_DEBUG_LEVEL 
 

OPT_DEREF

OPT_DEREF = LDAP_OPT_DEREF 
 

OPT_ERROR_NUMBER

OPT_ERROR_NUMBER = LDAP_OPT_ERROR_NUMBER 
 

OPT_ERROR_STRING

OPT_ERROR_STRING = LDAP_OPT_ERROR_STRING 
 

OPT_HOST_NAME

OPT_HOST_NAME = LDAP_OPT_HOST_NAME 
 

OPT_MATCHED_DN

OPT_MATCHED_DN = LDAP_OPT_MATCHED_DN 
 

OPT_NETWORK_TIMEOUT

OPT_NETWORK_TIMEOUT = LDAP_OPT_NETWORK_TIMEOUT 
 

OPT_PROTOCOL_VERSION

OPT_PROTOCOL_VERSION = LDAP_OPT_PROTOCOL_VERSION 
 

OPT_REFERRALS

OPT_REFERRALS = LDAP_OPT_REFERRALS 
 

OPT_RESTART

OPT_RESTART = LDAP_OPT_RESTART 
 

OPT_SERVER_CONTROLS

OPT_SERVER_CONTROLS = LDAP_OPT_SERVER_CONTROLS 
 

OPT_SIZELIMIT

OPT_SIZELIMIT = LDAP_OPT_SIZELIMIT 
 

OPT_TIMELIMIT

OPT_TIMELIMIT = LDAP_OPT_TIMELIMIT 
 

OPT_X_SASL_AUTHCID

OPT_X_SASL_AUTHCID = LDAP_OPT_X_SASL_AUTHCID 
 

OPT_X_SASL_AUTHZID

OPT_X_SASL_AUTHZID = LDAP_OPT_X_SASL_AUTHZID 
 

OPT_X_SASL_MECH

OPT_X_SASL_MECH = LDAP_OPT_X_SASL_MECH 
 

OPT_X_SASL_REALM

OPT_X_SASL_REALM = LDAP_OPT_X_SASL_REALM 
 

OTHER

OTHER = 80 
 

PASSWORD_EXPIRED

PASSWORD_EXPIRED = 532 
 

PROTOCOL_ERROR

PROTOCOL_ERROR = 2 
 

REFERRAL

REFERRAL = 10 
 

RESTRICTED_TO_SPECIFIC_MACHINES

RESTRICTED_TO_SPECIFIC_MACHINES = 531 
 

RESULTS_TOO_LARGE

RESULTS_TOO_LARGE = 70 
 

SASL_BIND_IN_PROGRESS

SASL_BIND_IN_PROGRESS = 14 
 

SCOPE_BASE

SCOPE_BASE = 'ldap_read' 
 

SCOPE_ONELEVEL

SCOPE_ONELEVEL = 'ldap_list' 
 

SCOPE_SUBTREE

SCOPE_SUBTREE = 'ldap_search' 
 

SIZELIMIT_EXCEEDED

SIZELIMIT_EXCEEDED = 4 
 

STRONG_AUTH_REQUIRED

STRONG_AUTH_REQUIRED = 8 
 

SUCCESS

SUCCESS = 0 
 

TIMELIMIT_EXCEEDED

TIMELIMIT_EXCEEDED = 3 
 

TYPE_OR_VALUE_EXISTS

TYPE_OR_VALUE_EXISTS = 20 
 

UNAVAILABLE

UNAVAILABLE = 52 
 

UNAVAILABLE_CRITICAL_EXTENSION

UNAVAILABLE_CRITICAL_EXTENSION = 12 
 

UNDEFINED_TYPE

UNDEFINED_TYPE = 17 
 

UNWILLING_TO_PERFORM

UNWILLING_TO_PERFORM = 53 
   

USER_MUST_RESET_PASSWORD

USER_MUST_RESET_PASSWORD = 773 
 

USER_NOT_FOUND

USER_NOT_FOUND = 525