ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:ldap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
database:ldap [2015/11/26 23:47] mnewnhamv5:database:ldap [2023/11/18 12:29] – [Usage] Refer to example.com. Link to ldap.com for query filter syntax dregad
Line 1: Line 1:
 ====== LDAP ====== ====== LDAP ======
 +~~NOTOC~~
 +<WRAP right box round 300px>
 +== Specification ==
 +^Driver Name|ldap|
 +^Data Provider|ldap|
 +^Status|Inactive((This driver is not actively supported or enhanced by ADOdb project members, but you can provide fixes and enhancements if you have the expertise))|
 +^Windows|Yes|
 +^Unix|Perhaps((We have never tried it except against Microsoft LDAP servers from Windows))|
 +^ADOdb V5|Yes|
 +^ADOdb V6|Yes|
 +
 +</WRAP>
 ===== Description ===== ===== Description =====
 The ''ldap'' driver provides a small subset of ADOdb commands allowing **read-only** access to an LDAP database. The ''ldap'' driver provides a small subset of ADOdb commands allowing **read-only** access to an LDAP database.
-===== Support Status ===== 
-This driver is currently unsupported. If you have expertise and want to help the project, let us know 
- 
-===== Specification ===== 
-|Driver|ldap| 
-|Status|Unsupported| 
-|Supported OS|Windows Yes, Other platforms unknown| 
 ===== Available Methods ===== ===== Available Methods =====
 The following methods are available for use with the LDAP driver: The following methods are available for use with the LDAP driver:
  
-  * [[reference:getassoc|getAssoc()]] +  * [[v5:reference:connection:getassoc|execute()]] 
-  * [[reference:selectdb|selectDb()]] +  * [[v5:reference:connection:getassoc|getAssoc()]] 
-  * [[dictionary:serverinfo|serverInfo()]] +  * [[v5:reference:connection:selectdb|selectDb()]] 
-  * [[reference:getrowassoc|getRowAssoc()]]+  * [[v5:reference:connection:serverinfo|serverInfo()]] 
 +  * [[v5:reference:connection:getrowassoc|getRowAssoc()]] 
 +  * [[v5:reference:connection:setConnectionParameter|setConnectionParameter()]]
      
 Calls to other methods when used with this driver may produce unexpected results or program failure.  Calls to other methods when used with this driver may produce unexpected results or program failure. 
 ===== Usage ===== ===== Usage =====
 +
 +You must use standard [[https://ldap.com/ldap-filters/|LDAP filter terms]] rather than SQL statements when executing a query. Any value provided in the //$bindvars// parameter is ignored,
 +
 <code php> <code php>
 $db = newAdoConnection('ldap'); $db = newAdoConnection('ldap');
 +$baseDN   = 'dc=example,dc=com';
 +$adServer = 'example.com';
 +$user     = 'adodb@example.com';
 +$password = 'adodb!';
 +
 +$db->connect($adServer,$user,$password,$baseDN);
 +
 +$result = $db->execute('(samaccountname=adodb)');
  
 </code> </code>
  
-===== Custom Functionality ===== +==== URI Connections ==== 
-If defined prior to connection, the following variables will be passed as input bind variables+The **//Server//** definition can be set in the form ''ldap://server-name''You must use this if you want to: 
-Valid Domain Values for LDAP Options+  - Use an alternate connection port ''ldap:⁄⁄server-name:3389'' 
-  LDAP_OPT_DEREF (integer+  - Use ldap over SSL - ''ldaps:⁄⁄server-name'' 
-  LDAP_OPT_SIZELIMIT (integer) + 
-  LDAP_OPT_TIMELIMIT (integer) + 
-  LDAP_OPT_PROTOCOL_VERSION (integer) + 
-  LDAP_OPT_ERROR_NUMBER (integer) + 
-  LDAP_OPT_REFERRALS (boolean) +===== Connection Parameters ===== 
-  LDAP_OPT_RESTART (boolean) + 
-  LDAP_OPT_HOST_NAME (string) +The following values may be injected into the connection via the use of [[v5:reference:connection:getrowassoc|setConnectionParameter()]] 
-  LDAP_OPT_ERROR_STRING (string) + 
-  LDAP_OPT_MATCHED_DN (string) + 
-  LDAP_OPT_SERVER_CONTROLS (array) +^ OPTION_NAME ^ Type ^ 
-  LDAP_OPT_CLIENT_CONTROLS (array)+| ''LDAP_OPT_DEREF'' | integer | 
 +| ''LDAP_OPT_SIZELIMIT''integer | 
 +| ''LDAP_OPT_TIMELIMIT''integer | 
 +| ''LDAP_OPT_PROTOCOL_VERSION''integer | 
 +| ''LDAP_OPT_ERROR_NUMBER''integer | 
 +| ''LDAP_OPT_REFERRALS''boolean | 
 +| ''LDAP_OPT_RESTART''boolean | 
 +| ''LDAP_OPT_HOST_NAME''string | 
 +| ''LDAP_OPT_ERROR_STRING''string | 
 +| ''LDAP_OPT_MATCHED_DN''string | 
 +| ''LDAP_OPT_SERVER_CONTROLS''array | 
 +| ''LDAP_OPT_CLIENT_CONTROLS''array 
 + 
 + 
 +From ADOdb 5.22.7, default values set are as follows 
 + 
 +^Parameter^Value^ 
 +|LDAP_OPT_PROTOCOL_VERSION|3| 
 +|LDAP_OPT_REFERRALS|0| 
 + 
 +These values can be changed with **//setConnectionParameter()//** 
 + 
 +The following usage method is deprecated in PHP8.2 and will not work with PHP 8.3. Use **//setConnectionParameter()//** instead. 
  
-Make sure to set this BEFORE calling Connect() 
-Example: 
 <code php> <code php>
 $LDAP_CONNECT_OPTIONS = Array( $LDAP_CONNECT_OPTIONS = Array(
Line 57: Line 95:
  ),  ),
  Array (  Array (
- "OPTION_NAME"=>LDAP_OPT_PROTOCOL_VERSION,+ "OPTION_NAME"=>,
  "OPTION_VALUE"=>3  "OPTION_VALUE"=>3
  ),  ),
Line 75: Line 113:
 </code> </code>
  
-{{tag>[dormant]}}+{{tag>[dormant tier2]}}
  
v5/database/ldap.txt · Last modified: 2023/11/18 23:45 by mnewnham