phpLDAPadmin

# Class: ldap_pla

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

### Class Overview

    DS
       |
       --myldap
          |
          --ldap_pla

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

### Methods

- __construct
- add
- checkUniqueAttrs
- delete
- isAnonBindAllowed
- isAttrHidden
- isAttrReadOnly
- isAttrUnique
- isBranchRenameEnabled
- isMultiLineAttr
- isSessionValid
- isShowCreateEnabled
- modify
- rename
- __get

### Inherited Variables

#### Class: DS

DS::$custom
DS::$default
DS::$index
DS::$type

### Inherited Methods

#### Class: myldap

myldap::__construct()
myldap::connect()
  Connect and Bind to the Database
myldap::dnExists()
  Gets whether an entry exists based on its DN. If the entry exists, returns true. Otherwise returns false.
myldap::escapeDN()
  Parse a DN and escape any special characters
myldap::getBaseDN()
  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).
myldap::getContainer()
  Given a DN string, this returns the parent container portion of the string.
myldap::getContainerContents()
  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:
myldap::getContainerPath()
  Given a DN string and a path like syntax, this returns the parent container portion of the string.
myldap::getContainerTop()
  Given a DN string, this returns the top container portion of the string.
myldap::getDNAttrValue()
  Much like getDNAttrValues(), but only returns the values for one attribute of an object. Example calls:
myldap::getDNAttrValues()
  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.
myldap::getErrorMessage()
  Get the last error string
myldap::getErrorNum()
  Get the last error number
myldap::getLoginID()
  Get a user ID
myldap::getRootDSE()
myldap::getSchemaAttribute()
  Gets a single AttributeType object specified by name.
myldap::getSchemaObjectClass()
  Gets a single ObjectClass object specified by name.
myldap::isAnonBindAllowed()
  Return if anonymous bind is allowed in the configuration
myldap::isAttrBinary()
  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.
myldap::isAttrBoolean()
  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.
myldap::isDNAttr()
  Returns true if the attribute specified is required to take as input a DN.
myldap::isForceMay()
  This function determines if the specified attribute is contained in the force_may list as configured in config.php.
myldap::isJpegPhoto()
  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.
myldap::login()
  Login to the database with the application user/password
myldap::MatchingRules()
  Returns an array of MatchingRule objects for the specified server.
myldap::modify()
  Modify attributes of a DN
myldap::query()
  Perform a query to the Database
myldap::SchemaAttributes()
  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.
myldap::SchemaObjectClasses()
  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.
myldap::SchemaSyntaxes()
  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.
myldap::userIsAllowedLogin()
  This function will determine if the user is allowed to login based on a filter
myldap::userIsMember()
  This function will test if a user is a member of a group.

#### 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 variables and methods for LDAP datastores for use by PLA.
[ Top ]

### Class Methods

### constructor __construct [line 19]

`ldap_pla __construct( $index)`

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

#### Parameters:

| $index |

[ Top ]

### method add [line 338]

`void add( $dn, $entry_array, [ $method = null])`

Add objects

#### Tags:

access: | public

#### Parameters:

| $dn |
| $entry_array |
| $method |

[ Top ]

### method checkUniqueAttrs [line 569]

`void checkUniqueAttrs( dn $dn, string $attrs, string|array 2)`

This function will check whether the value for an attribute being changed is already assigned to another DN.

Returns the bad value, or null if all values are OK

#### Tags:

access: | public

#### Parameters:

string|array | 2 | New values for the attribute
dn | $dn | DN that is being changed
string | $attrs | Attribute being changed

[ Top ]

### method delete [line 382]

`void delete( $dn, [ $method = null])`

Delete objects

#### Tags:

access: | public

#### Parameters:

| $dn |
| $method |

[ Top ]

### method isAnonBindAllowed [line 177]

`boolean isAnonBindAllowed( )`

Fetch whether the user has configured a certain server login to be non anonymous

1. $servers-> setValue ('login','anon_bind',true|false);

#### Tags:

access: | public

Overrides myldap::isAnonBindAllowed() (Return if anonymous bind is allowed in the configuration)
[ Top ]

### method isAttrHidden [line 325]

`boolean isAttrHidden( string $attr)`

Returns true if the specified attribute is configured as hidden in config.php.

Attributes are configured as hidden in config.php thus:

1. $config-> custom ->appearance['hide_attrs'] = array('objectClass');

#### Tags:

access: | public

#### Parameters:

string | $attr | The name of the attribute to test.

[ Top ]

### method isAttrReadOnly [line 304]

`boolean isAttrReadOnly( string $attr)`

Returns true if the specified attribute is configured as read only in config.php.

Attributes are configured as read-only in config.php thus:

1. $config-> custom ->appearance['readonly_attrs'] = array('objectClass');

#### Tags:

access: | public

#### Parameters:

string | $attr | The name of the attribute to test.

[ Top ]

### method isAttrUnique [line 548]

`boolean isAttrUnique( string $attr)`

Returns true if the specified attribute is configured as unique in config.php.

Attributes are configured as hidden in config.php thus:

1. $servers-> setValue ('unique','attrs',array('mail','uid','uidNumber'));

#### Tags:

access: | public

#### Parameters:

string | $attr | The name of the attribute to test.

[ Top ]

### method isBranchRenameEnabled [line 203]

`boolean isBranchRenameEnabled( )`

Returns true if the user has configured the specified server to enable branch (non-leaf) renames.

This is configured in config.php thus:

1. $servers-> setValue ('server','branch_rename',true|false);

[ Top ]

### method isMultiLineAttr [line 227]

`boolean isMultiLineAttr( string $attr_name, [string $val = null])`

Determines if an attribute's value can contain multiple lines. Attributes that fall in this multi-line category may be configured in config.php. Hence, this function accesses the global variable $_SESSION[APPCONFIG]->custom->appearance['multi_line_attributes'];

Usage example:

1. if ($ldapserver-> isMultiLineAttr ('postalAddress'))
2. echo '<textarea name="postalAddress"></textarea>';
3. else
4. echo '<input name="postalAddress" type="text">';

#### Parameters:

string | $attr_name | The name of the attribute of interested (case insensivite)
string | $val | (optional) The current value of the attribute (speeds up the process by searching for carriage returns already in the attribute value)

[ Top ]

### method isSessionValid [line 633]

`void isSessionValid( )`

Check if the session timeout has occured for this LDAP server.

#### Tags:

access: | public

Overrides DS::isSessionValid() (This method should be overridden in application specific ds files)
[ Top ]

### method isShowCreateEnabled [line 158]

`boolean isShowCreateEnabled( )`

Gets whether the admin has configured phpLDAPadmin to show the "Create New" link in the tree viewer.

1. $servers-> setValue ('appearance','show_create',true|false);

If NOT set, then default to show the Create New item. If IS set, then return the value (it should be true or false).

The entry creation command must be available.

1. $config-> custom ->commands['script'] = array('create' => true);

#### Tags:

return: | true if the feature is enabled and false otherwise.

[ Top ]

### method modify [line 435]

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

Modify objects

#### Tags:

access: | public

Overrides myldap::modify() (Modify attributes of a DN)

#### Parameters:

| $dn |
| $attrs |
| $method |

[ Top ]

### method rename [line 408]

`void rename( $dn, $new_rdn, $container, $deleteoldrdn, [ $method = null])`

Rename objects

#### Tags:

access: | public

#### Parameters:

| $dn |
| $new_rdn |
| $container |
| $deleteoldrdn |
| $method |

[ Top ]

### method __get [line 130]

`void __get( $key)`

#### Tags:

access: | public

#### Parameters:

| $key |

[ Top ]

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