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

Class: myldap

Source Location: /templates/3rdParty/pla/lib/ds_myldap.php

Class Overview

DS
   |
   --myldap

This abstract class provides the basic variables and methods for LDAP datastores


Methods


Child classes:

ldap_pla
This abstract class provides variables and methods for LDAP datastores for use by PLA.

Inherited Variables

Inherited Methods

Class: DS

DS::__construct()
DS::connect()
This will make the connection to the datasource
DS::getAuthType()
Return the authentication type for this object
DS::getErrorMessage()
Return error details from previous operation
DS::getErrorNum()
DS::getIndex()
DS::getLogin()
Get the login name of the user logged into this datastore's connection method If this returns null, we are not logged in.
DS::getMethod()
Work out which connection method to use.
DS::getName()
Get the name of this datastore
DS::getPassword()
Get the login password of the user logged into this datastore's connection method
DS::getValue()
Return a configuration value
DS::inactivityTime()
Return the time left in seconds until this connection times out. If there is not timeout, this function will return null.
DS::isDefaultKey()
DS::isDefaultSetting()
DS::isLoggedIn()
Return if this datastore's connection method has been logged into
DS::isReadOnly()
DS::isSessionValid()
This method should be overridden in application specific ds files
DS::isVisible()
Functions that return the condition of the datasource
DS::login()
Login to the datastore method: default = anon, connect to ds using bind_id not auth_id.
DS::logout()
Logout of this datastore's connection method
DS::query()
Query the datasource
DS::setDefaults()
Functions that set and verify object configuration details
DS::setLogin()
Set the login details of the user logged into this datastore's connection method
DS::setValue()
Set a configuration value
DS::untested()
Return the untested config items

Class Details

[line 15]
This abstract class provides the basic variables and methods for LDAP datastores



[ Top ]


Class Methods


constructor __construct [line 25]

myldap __construct( $index)



Tags:

access:  public


Overridden in child classes as:

ldap_pla::__construct()

Overrides DS::__construct() (parent method not documented)

Parameters:

   $index  

[ Top ]

method connect [line 129]

resource|null connect( string $method, [ $debug = false], [ $new = false])

Connect and Bind to the Database



Tags:

return:  Connection resource if successful, null if not.
access:  protected


Overrides DS::connect() (This will make the connection to the datasource)

Parameters:

string   $method   Which connection method resource to use
   $debug  
   $new  

[ Top ]

method dnExists [line 839]

boolean dnExists( string $dn, [string $method = null])

Gets whether an entry exists based on its DN. If the entry exists, returns true. Otherwise returns false.



Tags:

access:  public


Parameters:

string   $dn   The DN of the entry of interest.
string   $method   Which connection method resource to use

[ Top ]

method escapeDN [line 1083]

void escapeDN( $dn)

Parse a DN and escape any special characters



Tags:

access:  protected


Parameters:

   $dn  

[ Top ]

method getBaseDN [line 789]

array getBaseDN( [string $method = null])

Gets the root DN of the specified LDAPServer, or null if it can't find it (ie, the server won't give it to us, or it isnt specified in the configuration file).

Tested with OpenLDAP 2.0, Netscape iPlanet, and Novell eDirectory 8.7 (nldap.com) Please report any and all bugs!!

Please note: On FC systems, it seems that php_ldap uses /etc/openldap/ldap.conf in the search base if it is blank - so edit that file and comment out the BASE line.




Tags:

return:  dn|null The root DN of the server on success (string) or null on error.
todo:  Sort the entries, so that they are in the correct DN order.
access:  public


Parameters:

string   $method   Which connection method resource to use

[ Top ]

method getContainer [line 930]

string getContainer( string $dn)

Given a DN string, this returns the parent container portion of the string.

For example. given 'cn=Manager,dc=example,dc=com', this function returns 'dc=example,dc=com'.




Tags:

return:  The container
access:  public


Parameters:

string   $dn   The DN whose container string to return.

[ Top ]

method getContainerContents [line 985]

array getContainerContents( string $dn, [string $method = null], [int $size_limit = 0], [string $filter = '(objectClass=*)'], [constant $deref = LDAP_DEREF_NEVER])

Gets a list of child entries for an entry. Given a DN, this function fetches the list of DNs of child entries one level beneath the parent. For example, for the following tree:

  1.     dc=example,dc=com
  2.         ou=People
  3.             cn=Dave
  4.             cn=Fred
  5.             cn=Joe
  6.         ou=More People
  7.             cn=Mark
  8.             cn=Bob

Calling

  1. getContainerContents("ou=people,dc=example,dc=com")
would return the following list:

  1.     cn=Dave
  2.     cn=Fred
  3.     cn=Joe
  4.     ou=More People




Tags:

return:  An array of DN strings listing the immediate children of the specified entry.
access:  public


Parameters:

string   $dn   The DN of the entry whose children to return.
string   $method   Which connection method resource to use
int   $size_limit   (optional) The maximum number of entries to return. If unspecified, no limit is applied to the number of entries in the returned.
string   $filter   (optional) An LDAP filter to apply when fetching children, example: "(objectClass=inetOrgPerson)"
constant   $deref   (optional) The LDAP deref setting to use in the query

[ Top ]

method getContainerPath [line 883]

string getContainerPath( string $dn, [string $path = '..'])

Given a DN string and a path like syntax, this returns the parent container portion of the string.



Tags:

return:  The container
access:  public


Parameters:

string   $dn   The DN whose container string to return.
string   $path   Either '/', '.' or something like '../../<rdn>'

[ Top ]

method getContainerTop [line 857]

string getContainerTop( string $dn)

Given a DN string, this returns the top container portion of the string.



Tags:

return:  The container
access:  public


Parameters:

string   $dn   The DN whose container string to return.

[ Top ]

method getDNAttrValue [line 1943]

array getDNAttrValue( string $dn, string $attr, [string $method = null], [constant $deref = LDAP_DEREF_NEVER])

Much like getDNAttrValues(), but only returns the values for one attribute of an object. Example calls:

  1.     print_r(getDNAttrValue('cn=Bob,ou=people,dc=example,dc=com','sn'));
  2.     Array (
  3.         [0=> Smith
  4.     )
  5.  
  6.  print_r(getDNAttrValue('cn=Bob,ou=people,dc=example,dc=com','objectClass'));
  7.     Array (
  8.         [0=> top
  9.         [1=> person
  10.     )




Tags:

see:  myldap::getDNAttrValues()
todo:  Caching these values may be problematic with multiple calls and different deref values.
access:  public


Parameters:

string   $dn   The distinguished name (DN) of the entry whose attributes/values to fetch.
string   $attr   The attribute whose value(s) to return (ie, "objectClass", "cn", "userPassword")
string   $method   Which connection method resource to use
constant   $deref   For aliases and referrals, this parameter specifies whether to follow references to the referenced DN or to fetch the attributes for the referencing DN. See http://php.net/ldap_search for the 4 valid options.

[ Top ]

method getDNAttrValues [line 1997]

array getDNAttrValues( string $dn, [string $method = null], [constant $deref = LDAP_DEREF_NEVER], [ $attrs = array('*','+')])

Gets the attributes/values of an entry. Returns an associative array whose keys are attribute value names and whose values are arrays of values for said attribute.

Optionally, callers may specify true for the parameter $lower_case_attr_names to force all keys in the associate array (attribute names) to be lower case.

Example of its usage:

  1.  print_r(getDNAttrValues('cn=Bob,ou=pepole,dc=example,dc=com')
  2.     Array (
  3.         [objectClass=> Array (
  4.             [0=> person
  5.             [1=> top
  6.         )
  7.         [cn=> Array (
  8.             [0=> Bob
  9.         )
  10.         [sn=> Array (
  11.             [0=> Jones
  12.         )
  13.         [dn=> Array (
  14.             [0=> cn=Bob,ou=pepole,dc=example,dc=com
  15.         )
  16.     )




Tags:

see:  getDNSysAttrs
see:  myldap::getDNAttrValue()
access:  public


Parameters:

string   $dn   The distinguished name (DN) of the entry whose attributes/values to fetch.
string   $method   Which connection method resource to use
constant   $deref   For aliases and referrals, this parameter specifies whether to follow references to the referenced DN or to fetch the attributes for the referencing DN. See http://php.net/ldap_search for the 4 valid options.
   $attrs  

[ Top ]

method getErrorMessage [line 444]

void getErrorMessage( [string $method = null])

Get the last error string



Tags:

access:  public


Overrides DS::getErrorMessage() (Return error details from previous operation)

Parameters:

string   $method   Which connection method resource to use

[ Top ]

method getErrorNum [line 456]

void getErrorNum( [string $method = null])

Get the last error number



Tags:

access:  public


Overrides DS::getErrorNum() (parent method not documented)

Parameters:

string   $method   Which connection method resource to use

[ Top ]

method getLoginID [line 471]

void getLoginID( string $user, [ $method = null])

Get a user ID



Tags:

access:  public


Parameters:

string   $user   Which connection method resource to use
   $method  

[ Top ]

method getRootDSE [line 1120]

void getRootDSE( [ $method = null])



Tags:

access:  public


Parameters:

   $method  

[ Top ]

method getSchemaAttribute [line 1513]

AttributeType getSchemaAttribute( $attr_name, [ $method = null], [string $dn = ''], string $oclass_name)

Gets a single AttributeType object specified by name.



Tags:

return:  The specified AttributeType object or false on error.
see:  AttributeType
see:  myldap::SchemaAttributes()
access:  public


Parameters:

string   $oclass_name   The name of the AttributeType to fetch.
string   $dn   (optional) It is easier to fetch schema if a DN is provided which defines the subschemaSubEntry attribute (all entries should).
   $attr_name  
   $method  

[ Top ]

method getSchemaObjectClass [line 1482]

ObjectClass getSchemaObjectClass( string $oclass_name, [ $method = null], [string $dn = ''])

Gets a single ObjectClass object specified by name.



Tags:

return:  The specified ObjectClass object or false on error.
see:  ObjectClass
see:  myldap::SchemaObjectClasses()
access:  public


Parameters:

string   $oclass_name   The name of the objectClass to fetch.
string   $dn   (optional) It is easier to fetch schema if a DN is provided which defines the subschemaSubEntry attribute (all entries should).
   $method  

[ Top ]

method isAnonBindAllowed [line 527]

void isAnonBindAllowed( )

Return if anonymous bind is allowed in the configuration



Tags:

access:  public


Overridden in child classes as:

ldap_pla::isAnonBindAllowed()
Fetch whether the user has configured a certain server login to be non anonymous

[ Top ]

method isAttrBinary [line 2153]

boolean isAttrBinary( string $attr_name)

Given an attribute name and server ID number, this function returns whether the attribute may contain binary data. This is useful for developers who wish to display the contents of an arbitrary attribute but don't want to dump binary data on the page.



Tags:



Parameters:

string   $attr_name   The name of the attribute to test.

[ Top ]

method isAttrBoolean [line 2127]

boolean isAttrBoolean( string $attr_name)

Given an attribute name and server ID number, this function returns whether the attrbiute contains boolean data. This is useful for developers who wish to display the contents of a boolean attribute with a drop-down.



Parameters:

string   $attr_name   The name of the attribute to test.

[ Top ]

method isDNAttr [line 2055]

boolean isDNAttr( string $attr_name, [ $method = null])

Returns true if the attribute specified is required to take as input a DN.

Some examples include 'distinguishedName', 'member' and 'uniqueMember'.




Parameters:

string   $attr_name   The name of the attribute of interest (case insensitive)
   $method  

[ Top ]

method isForceMay [line 1908]

boolean isForceMay( $attr_name)

This function determines if the specified attribute is contained in the force_may list as configured in config.php.



Tags:

return:  True if the specified attribute is in the $force_may list and false otherwise.


Parameters:

   $attr_name  

[ Top ]

method isJpegPhoto [line 2096]

boolean isJpegPhoto( string $attr_name)

Used to determine if the specified attribute is indeed a jpegPhoto. If the specified attribute is one that houses jpeg data, true is returned. Otherwise this function returns false.



Tags:



Parameters:

string   $attr_name   The name of the attribute to test.

[ Top ]

method login [line 247]

boolean login( [ $user = null], [ $pass = null], [ $method = null], [ $new = false])

Login to the database with the application user/password



Tags:

return:  true|false for successful login.
access:  public


Overrides DS::login() (Login to the datastore method: default = anon, connect to ds using bind_id not auth_id.)

Parameters:

   $user  
   $pass  
   $method  
   $new  

[ Top ]

method MatchingRules [line 1780]

void MatchingRules( [ $method = null], [ $dn = ''])

Returns an array of MatchingRule objects for the specified server.

The key of each entry is the OID of the matching rule.




Tags:

access:  public


Parameters:

   $method  
   $dn  

[ Top ]

method modify [line 766]

void modify( $dn, $attrs, [ $method = null])

Modify attributes of a DN



Tags:

access:  public


Overridden in child classes as:

ldap_pla::modify()
Modify objects

Parameters:

   $dn  
   $attrs  
   $method  

[ Top ]

method query [line 311]

array|null query( string $query, string $method, [string $index = null], [boolean $debug = false])

Perform a query to the Database



Tags:

return:  Results of query.
access:  public


Overrides DS::query() (Query the datasource)

Parameters:

string   $query   query to perform $query['base'] $query['filter'] $query['scope'] $query['attrs'] = array(); $query['deref']
string   $method   Which connection method resource to use
string   $index   Index items according to this key
boolean   $debug   Enable debugging output

[ Top ]

method SchemaAttributes [line 1601]

array SchemaAttributes( [ $method = null], [string $dn = ''])

Gets an associative array of AttributeType objects for the specified server. Each array entry's key is the name of the attributeType in lower-case and the value is an AttributeType object.



Tags:

return:  An array of AttributeType objects.
access:  public


Parameters:

string   $dn   (optional) It is easier to fetch schema if a DN is provided which defines the subschemaSubEntry attribute (all entries should).
   $method  

[ Top ]

method SchemaObjectClasses [line 1545]

array SchemaObjectClasses( [ $method = null], [string $dn = ''])

Gets an associative array of ObjectClass objects for the specified server. Each array entry's key is the name of the objectClass in lower-case and the value is an ObjectClass object.



Tags:

return:  An array of ObjectClass objects.
see:  ObjectClass
see:  myldap::getSchemaObjectClass()
access:  public


Parameters:

string   $dn   (optional) It is easier to fetch schema if a DN is provided which defines the subschemaSubEntry attribute (all entries should).
   $method  

[ Top ]

method SchemaSyntaxes [line 1856]

void SchemaSyntaxes( [ $method = null], [ $dn = ''])

Returns an array of Syntax objects that this LDAP server uses mapped to their descriptions. The key of each entry is the OID of the Syntax.



Tags:

access:  public


Parameters:

   $method  
   $dn  

[ Top ]

method userIsAllowedLogin [line 2268]

void userIsAllowedLogin( $dn)

This function will determine if the user is allowed to login based on a filter



Tags:

access:  protected


Parameters:

   $dn  

[ Top ]

method userIsMember [line 2237]

bool userIsMember( string $user, dn $group)

This function will test if a user is a member of a group.

Inputs:




Tags:

return:  true|false


Parameters:

string   $user   membership value that is being checked
dn   $group   DN to see if user is a member

[ Top ]


Documentation generated on Tue, 22 Nov 2011 16:29:38 +0100 by phpDocumentor 1.4.1