Net_LDAP
[ class tree: Net_LDAP ] [ index: Net_LDAP ] [ all elements ]

Class: Net_LDAP

Source Location: /Net_LDAP-0.7.3/LDAP.php

Class Overview

PEAR
   |
   --Net_LDAP

Net_LDAP - manipulate LDAP servers the right way!


Author(s):

Version:

  • CVS: $Id: LDAP.php,v 1.50 2007/06/12 11:02:03 beni Exp $

Copyright:

  • 2003-2007 Tarjej Huse, Jan Wagner, Del Elson, Benedikt Hallinger

Methods


Inherited Variables

Inherited Methods


Class Details

[line 50]
Net_LDAP - manipulate LDAP servers the right way!


[ Top ]


Method Detail

Net_LDAP (Constructor)   [line 176]

void Net_LDAP( [array $config = array()])

Net_LDAP constructor

Sets the config array

Please note that the usual way of getting Net_LDAP to work is to call something like:

  1. $ldap Net_LDAP::connect($ldap_config);

  • See: $_config
  • Access: protected

Parameters:

array   $config   —  Configuration array

[ Top ]

add   [line 495]

Net_LDAP_Error|true add( Net_LDAP_Entry $entry)

Add a new entryobject to a directory.

Use add to add a new Net_LDAP_Entry object to the directory.

  • Return: Net_LDAP_Error object or true

Parameters:

Net_LDAP_Entry   $entry   —  Net_LDAP_Entry

[ Top ]

bind   [line 254]

Net_LDAP_Error|true bind( [string $dn = null], [string $password = null])

Bind to the ldap-server

This function binds with the given dn and password to the server. In case no connection has been made yet, it will be startet and startTLS issued if appropiate.

  • Return: Net_LDAP_Error object or true
  • Access: public

Parameters:

string   $dn   —  Distinguished name for binding
string   $password   —  Password for binding

[ Top ]

checkLDAPExtension   [line 1096]

Net_LDAP_Error|true checkLDAPExtension( )

Checks if phps ldap-extension is loaded

If it is not loaded, it tries to load it manually using PHPs dl(). It knows both windows-dll and *nix-so.


[ Top ]

connect   [line 145]

Net_LDAP_Error|Net_LDAP &connect( [array $config = array()])

Creates the initial ldap-object

Static function that returns either an error object or the new Net_LDAP object. Something like a factory. Takes a config array with the needed parameters.

  • Return: Net_LDAP_Error or Net_LDAP object
  • Access: public

Parameters:

array   $config   —  Configuration array

[ Top ]

delete   [line 521]

Net_LDAP_Error|true delete( string|Net_LDAP_Entry $dn, [boolean $recursive = false])

Delete an entry from the directory

The object may either be a string representing the dn or a Net_LDAP_Entry object. When the boolean paramter recursive is set, all subentries of the entry will be deleted as well.

  • Return: Net_LDAP_Error object or true
  • Access: public

Parameters:

string|Net_LDAP_Entry   $dn   —  DN-string or Net_LDAP_Entry
boolean   $recursive   —  Should we delete all children recursive as well?

[ Top ]

dnExists   [line 822]

boolean dnExists( string $dn)

Tell if a dn already exists
  • Todo: exploding is not the safest way - we should work with util class here!

Parameters:

string   $dn   —  The DN of the object to test

[ Top ]

done   [line 472]

void done( )

Close LDAP connection.

Closes the connection. Use this when the session is over.


[ Top ]

errorMessage   [line 886]

string errorMessage( int $errorcode)

Returns the string for an ldap errorcode.

Made to be able to make better errorhandling Function based on DB::errorMessage() Tip: The best description of the errorcodes is found here: http://www.directory-info.com/LDAP/LDAPErrorCodes.html

  • Return: The errorstring for the error.

Parameters:

int   $errorcode   —  Error code

[ Top ]

getEntry   [line 855]

Net_LDAP_Entry|Net_LDAP_Error &getEntry( string $dn, [array $attr = array()])

Get a specific entry based on the DN
  • Return: Reference to a Net_LDAP_Entry object or Net_LDAP_Error object
  • Todo: Maybe check against the shema should be done to be sure the attribute type exists

Parameters:

string   $dn   —  DN of the entry that should be fetched
array   $attr   —  Array of Attributes to select

[ Top ]

getLDAPVersion   [line 790]

int getLDAPVersion( )

Get the LDAP_PROTOCOL_VERSION that is used on the connection.

A lot of ldap functionality is defined by what protocol version the ldap server speaks. This might be 2 or 3.


[ Top ]

getLink   [line 1194]

resource &getLink( )

Get the LDAP link
  • Return: LDAP link
  • Access: public

[ Top ]

getOption   [line 758]

Net_LDAP_Error|string getOption( string $option)

Get an LDAP option value
  • Return: Net_LDAP_Error or option value
  • Access: public

Parameters:

string   $option   —  Option to get

[ Top ]

getVersion   [line 129]

string getVersion( )

Returns the Net_LDAP Release version, may be called statically
  • Return: Net_LDAP version

[ Top ]

isError   [line 965]

boolean isError( mixed $value)

Tell whether value is a Net_LDAP_Error or not
  • Access: public

Parameters:

mixed   $value   —  A variable, most commonly some Net_LDAP* object

[ Top ]

modify   [line 578]

Net_LDAP_Error|true modify( string|Net_LDAP_Entry $entry, [ $parms = array()], array $params)

Modify an ldapentry

This one takes the dn or a Net_LDAP_Entry object and an array of actions. This array should be something like this:

array('add' => array('attribute1' => array('val1', 'val2'), 'attribute2' => array('val1')), 'delete' => array('attribute1'), 'replace' => array('attribute1' => array('val1')), 'changes' => array('add' => ..., 'delete' => array('attribute1', 'attribute2'), 'delete' => array('attribute2' => array('val1')), 'replace' => ...))

The changes array is there so the order of operations can be influenced (the operations are done in order of appearance). The function calls the corresponding functions of an Net_LDAP_Entry object. A detailed description of array structures can be found there.

  • Return: Net_LDAP_Error object or true
  • Access: public

Parameters:

string|Net_LDAP_Entry   $entry   —  DN-string or Net_LDAP_Entry
array   $params   —  Array of changes
   $parms   — 

[ Top ]

rootDse   [line 978]

Net_LDAP_Error|Net_LDAP_RootDSE &rootDse( [array $attrs = null])

gets a root dse object
  • Return: Net_LDAP_Error or Net_LDAP_RootDSE object
  • Author: Jan Wagner <wagner@netsols.de>
  • Access: public

Parameters:

array   $attrs   —  Array of attributes to search for

[ Top ]

root_dse   [line 1011]

void &root_dse( )

alias function of rootDse() for perl-ldap interface

[ Top ]

schema   [line 1025]

Net_LDAP_Schema|Net_LDAP_Error &schema( [string $dn = null])

get a schema object
  • Return: Net_LDAP_Schema or Net_LDAP_Error object
  • Author: Jan Wagner <wagner@netsols.de>
  • Access: public

Parameters:

string   $dn   —  Subschema entry dn

[ Top ]

search   [line 648]

Net_LDAP_Search|Net_LDAP_Error search( [string $base = null], [string|Net_LDAP_Filter $filter = null], [array $params = array()])

Run a ldap query

Search is used to query the ldap-database. $base and $filter may be ommitted.The one from config will then be used. Params may contain:

scope: The scope which will be used for searching base - Just one entry sub - The whole tree one - Immediately below $base sizelimit: Limit the number of entries returned (default: 0), timelimit: Limit the time spent for searching (default: 0), attrsonly: If true, the search will only return the attribute names, attributes: Array of attribute names, which the entry should contain. It is good practice to limit this to just the ones you need [NOT IMPLEMENTED] deref: By default aliases are dereferenced to locate the base object for the search, but not when searching subordinates of the base object. This may be changed by specifying one of the following values:

never - Do not dereference aliases in searching or in locating the base object of the search. search - Dereference aliases in subordinates of the base object in searching, but not in locating the base object of the search. find always

  • Return: Net_LDAP_Search object or Net_LDAP_Error object
  • Access: public

Parameters:

string   $base   —  LDAP searchbase
string|Net_LDAP_Filter   $filter   —  LDAP search filter or a Net_LDAP_Filter object
array   $params   —  Array of options

[ Top ]

setLDAPVersion   [line 806]

Net_LDAP_Error|true setLDAPVersion( [int $version = 0])

Set the LDAP_PROTOCOL_VERSION that is used on the connection.
  • Return: Net_LDAP_Error object or true

Parameters:

int   $version   —  Version to set

[ Top ]

setOption   [line 727]

Net_LDAP_Error|true setOption( string $option, mixed $value)

Set an LDAP option
  • Return: Net_LDAP_Error object or true
  • Access: public

Parameters:

string   $option   —  Option to set
mixed   $value   —  Value to set Option to

[ Top ]

startTLS   [line 444]

Net_LDAP_Error|true startTLS( )

Starts an encrypted session
  • Return: Net_LDAP_Error object or true
  • Access: public

[ Top ]

start_tls   [line 459]

void start_tls( )

alias function of startTLS() for perl-ldap interface

[ Top ]

utf8Decode   [line 1128]

array utf8Decode( array $attributes)

Decodes the given attribute values
  • Return: Array with decoded attribute values
  • Access: public

Parameters:

array   $attributes   —  Array of attributes

[ Top ]

utf8Encode   [line 1116]

array utf8Encode( array $attributes)

Encodes given attributes to UTF8 if needed

This function takes attributes in an array and then checks against the schema if they need UTF8 encoding. If that is so, they will be encoded. An encoded array will be returned and can be used for adding or modifying.

  • Return: Array of UTF8 encoded attributes
  • Access: public

Parameters:

array   $attributes   —  Array of attributes

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:03:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.