PHP Class LdapTools\Object\LdapObjectManager

Author: Chad Sikorra ([email protected])
Datei anzeigen Open project: ldaptools/ldaptools

Protected Properties

Property Type Description
$connection LdapTools\Connection\LdapConnectionInterface
$dispatcher LdapTools\Event\EventDispatcherInterface
$schemaFactory LdapTools\Factory\LdapObjectSchemaFactory

Public Methods

Method Description
__construct ( LdapTools\Connection\LdapConnectionInterface $connection, LdapObjectSchemaFactory $schemaFactory, LdapTools\Event\EventDispatcherInterface $dispatcher )
delete ( LdapObject $ldapObject, boolean $recursively = false ) Removes an object from LDAP.
move ( LdapObject $ldapObject, string $container ) Moves an object from one container/OU to another in LDAP.
persist ( LdapObject $ldapObject ) Updates an object in LDAP. It will only update attributes that actually changed on the object.
restore ( LdapObject $ldapObject, null | string $location = null ) Restore a deleted LDAP object. Optionally pass the new location container/OU for the object. If a new location is not provided it will use the lastKnownParent value to determine where it should go.

Protected Methods

Method Description
executeBatchOperation ( LdapObject $ldapObject, string | null $dn = null )
getObjectRestoreLocation ( LdapObject $ldapObject, string | null $location ) : string It's possible a new location was not explicitly given and the attribute that contains the last know location was not queried for when the object was originally found. In that case attempt to retrieve the last known location from a separate LDAP query.
hydrateOperation ( BatchModifyOperation $operation, string $type ) Get the batch modification array that ldap_modify_batch expects.
validateObject ( LdapObject $ldapObject ) The DN attribute must be present to perform LDAP operations.

Method Details

__construct() public method

public __construct ( LdapTools\Connection\LdapConnectionInterface $connection, LdapObjectSchemaFactory $schemaFactory, LdapTools\Event\EventDispatcherInterface $dispatcher )
$connection LdapTools\Connection\LdapConnectionInterface
$schemaFactory LdapTools\Factory\LdapObjectSchemaFactory
$dispatcher LdapTools\Event\EventDispatcherInterface

delete() public method

Removes an object from LDAP.
public delete ( LdapObject $ldapObject, boolean $recursively = false )
$ldapObject LdapObject
$recursively boolean

executeBatchOperation() protected method

protected executeBatchOperation ( LdapObject $ldapObject, string | null $dn = null )
$ldapObject LdapObject
$dn string | null The DN to use for the batch operation to LDAP.

getObjectRestoreLocation() protected method

It's possible a new location was not explicitly given and the attribute that contains the last know location was not queried for when the object was originally found. In that case attempt to retrieve the last known location from a separate LDAP query.
protected getObjectRestoreLocation ( LdapObject $ldapObject, string | null $location ) : string
$ldapObject LdapObject
$location string | null
return string

hydrateOperation() protected method

Get the batch modification array that ldap_modify_batch expects.
protected hydrateOperation ( BatchModifyOperation $operation, string $type )
$operation LdapTools\Operation\BatchModifyOperation
$type string

move() public method

Moves an object from one container/OU to another in LDAP.
public move ( LdapObject $ldapObject, string $container )
$ldapObject LdapObject
$container string

persist() public method

Updates an object in LDAP. It will only update attributes that actually changed on the object.
public persist ( LdapObject $ldapObject )
$ldapObject LdapObject

restore() public method

This may require a strategy design at some point, as this is AD specific currently. Unsure as to how other directory services handle deleted object restores. The basic logic for AD to do this is... 1. Reset the 'isDeleted' attribute. 2. Set the DN so the object ends up in a location other than the "Deleted Objects" container.
public restore ( LdapObject $ldapObject, null | string $location = null )
$ldapObject LdapObject
$location null | string The DN of a container/OU where the restored object should go.

validateObject() protected method

The DN attribute must be present to perform LDAP operations.
protected validateObject ( LdapObject $ldapObject )
$ldapObject LdapObject

Property Details

$connection protected_oe property

protected LdapConnectionInterface,LdapTools\Connection $connection
return LdapTools\Connection\LdapConnectionInterface

$dispatcher protected_oe property

protected EventDispatcherInterface,LdapTools\Event $dispatcher
return LdapTools\Event\EventDispatcherInterface

$schemaFactory protected_oe property

protected LdapObjectSchemaFactory,LdapTools\Factory $schemaFactory
return LdapTools\Factory\LdapObjectSchemaFactory