FusionDirectory
|
This class contains all ldap function needed to make ldap operations easy. More...
Public Member Functions | |
__construct ($binddn, $bindpw, $hostname, $follow_referral=FALSE, $tls=FALSE) | |
Create a LDAP connection. More... | |
getSearchResource () | |
Get the search ressource. More... | |
connect () | |
Create a connection to LDAP server. More... | |
rebind ($ldap, $referral) | |
Rebind. | |
reconnect () | |
Reconnect to LDAP server. | |
unbind () | |
Unbind to LDAP server. | |
disconnect () | |
Disconnect to LDAP server. | |
cd ($dir) | |
Change directory. More... | |
getParentDir ($basedn='') | |
Accessor of the parent directory of the basedn. More... | |
search ($srp, $filter, $attrs=array(), $scope='subtree') | |
Search about filter. More... | |
object_match_filter ($dn, $filter) | |
Search object from a filter. More... | |
set_size_limit ($size) | |
Set a size limit. More... | |
fetch ($srp) | |
Fetch. More... | |
resetResult ($srp) | |
Reset the result. More... | |
clearResult ($srp) | |
Clear a result. More... | |
getDN ($srp) | |
Accessor of the DN. More... | |
count ($srp) | |
Return the numbers of entries. More... | |
rm ($attrs="", $dn="") | |
Remove. More... | |
rmdir ($deletedn) | |
Remove directory. More... | |
rename_dn ($source, $dest) | |
Move the given Ldap entry from $source to $dest. More... | |
rmdir_recursive ($srp, $deletedn) | |
Function rmdir_recursive. More... | |
modify (array $attrs) | |
Modify a entry of the directory LDAP. More... | |
add ($attrs) | |
Add entry in the LDAP directory. More... | |
get_additional_error () | |
Get the LDAP additional error. More... | |
success () | |
Success. More... | |
get_error () | |
Get the error. | |
get_errno () | |
Get the errno. More... | |
hitSizeLimit () | |
Check if the search hit the size limit. More... | |
generateLdif ($dn, $filter="(objectClass=*)", $scope='sub', $limit=0) | |
Generates an ldif for all entries matching the filter settings, scope and limit. More... | |
import_complete_ldif ($srp, $str_attr, $JustModify, $DeleteOldEntries) | |
Function to imports ldifs. More... | |
get_objectclasses ($force_reload=FALSE) | |
Get the object classes. More... | |
log ($string) | |
Add a string in log file. More... | |
getCn ($dn) | |
Function to get cn. More... | |
Static Public Member Functions | |
static | prepare4filter ($dn) |
Function to fix problematic characters in DN's that are used for search requests. I.e. member=.... More... | |
Protected Member Functions | |
import_single_entry ($srp, $data, $modify, $delete) | |
Function to Imports a single entry. More... | |
This class contains all ldap function needed to make ldap operations easy.
Definition at line 34 of file class_ldap.inc.
__construct | ( | $binddn, | |
$bindpw, | |||
$hostname, | |||
$follow_referral = FALSE , |
|||
$tls = FALSE |
|||
) |
Create a LDAP connection.
string | $binddn | Bind of the DN |
string | $bindpw | Bind |
string | $hostname | The hostname |
boolean | $follow_referral | FALSE |
boolean | $tls | FALSE |
Definition at line 82 of file class_ldap.inc.
References connect().
add | ( | $attrs | ) |
Add entry in the LDAP directory.
string | $attrs | The entry to add |
Definition at line 708 of file class_ldap.inc.
References connect(), reconnect(), and success().
Referenced by import_single_entry().
cd | ( | $dir | ) |
Change directory.
string | $dir | The new directory |
Definition at line 213 of file class_ldap.inc.
References getParentDir().
Referenced by import_single_entry(), and rmdir_recursive().
clearResult | ( | $srp | ) |
Clear a result.
integer | $srp | The result to clear |
Definition at line 431 of file class_ldap.inc.
Referenced by search().
connect | ( | ) |
Create a connection to LDAP server.
The string $error containts result of the connection
Definition at line 129 of file class_ldap.inc.
References reconnect().
Referenced by __construct(), add(), import_complete_ldif(), import_single_entry(), modify(), object_match_filter(), rename_dn(), rm(), rmdir(), rmdir_recursive(), and search().
count | ( | $srp | ) |
Return the numbers of entries.
$srp | srp |
Definition at line 471 of file class_ldap.inc.
Referenced by import_complete_ldif(), import_single_entry(), and modify().
fetch | ( | $srp | ) |
Fetch.
integer | $srp |
Definition at line 382 of file class_ldap.inc.
Referenced by import_single_entry(), and rmdir_recursive().
generateLdif | ( | $dn, | |
$filter = "(objectClass=*)" , |
|||
$scope = 'sub' , |
|||
$limit = 0 |
|||
) |
Generates an ldif for all entries matching the filter settings, scope and limit.
$dn | The entry to export. |
$filter | Limit the exported object to those maching this filter. |
$scope | 'base', 'sub' .. see manpage for 'ldapmodify' for details. |
$limit | Limits the result. |
Definition at line 962 of file class_ldap.inc.
get_additional_error | ( | ) |
Get the LDAP additional error.
Definition at line 870 of file class_ldap.inc.
Referenced by get_error(), and rmdir_recursive().
get_errno | ( | ) |
Get the errno.
Must be run right after the ldap request
Definition at line 910 of file class_ldap.inc.
Referenced by hitSizeLimit().
get_objectclasses | ( | $force_reload = FALSE | ) |
Get the object classes.
boolean | $force_reload | FALSE |
Definition at line 1218 of file class_ldap.inc.
References class_available(), session\global_get(), session\global_is_set(), and session\global_set().
getCn | ( | $dn | ) |
getDN | ( | $srp | ) |
getParentDir | ( | $basedn = '' | ) |
Accessor of the parent directory of the basedn.
string | $basedn | The basedn which we want the parent directory |
Definition at line 229 of file class_ldap.inc.
Referenced by cd().
getSearchResource | ( | ) |
hitSizeLimit | ( | ) |
Check if the search hit the size limit.
Must be run right after the search
Definition at line 924 of file class_ldap.inc.
References get_errno().
import_complete_ldif | ( | $srp, | |
$str_attr, | |||
$JustModify, | |||
$DeleteOldEntries | |||
) |
Function to imports ldifs.
If DeleteOldEntries is TRUE, the destination entry will be deleted first. If JustModify is TRUE the destination entry will only be touched by the attributes specified in the ldif. if JustMofify is FALSE the destination dn will be overwritten by the new ldif.
integer | $srp | |
string | $str_attr | |
boolean | $JustModify | |
boolean | $DeleteOldEntries |
Definition at line 1038 of file class_ldap.inc.
References connect(), count(), import_single_entry(), and reconnect().
|
protected |
Function to Imports a single entry.
If $delete is TRUE; The old entry will be deleted if it exists. if $modify is TRUE; All variables that are not touched by the new ldif will be kept. if $modify is FALSE; The new ldif overwrites the old entry, and all untouched attributes get lost.
integer | $srp | |
array | $data | |
boolean | $modify | |
boolean | $delete |
Definition at line 1141 of file class_ldap.inc.
References add(), cd(), connect(), count(), msg_dialog\display(), fetch(), get_error(), msgPool\ldaperror(), modify(), reconnect(), rmdir_recursive(), and success().
Referenced by import_complete_ldif().
log | ( | $string | ) |
Add a string in log file.
string | $string |
Definition at line 1329 of file class_ldap.inc.
References session\global_get(), and session\global_is_set().
modify | ( | array | $attrs | ) |
Modify a entry of the directory LDAP.
array | $attrs | The new entry |
Definition at line 682 of file class_ldap.inc.
References connect(), count(), reconnect(), and success().
Referenced by import_single_entry().
object_match_filter | ( | $dn, | |
$filter | |||
) |
Search object from a filter.
string | $dn | The DN |
string | $filter | The filter of the research |
Definition at line 344 of file class_ldap.inc.
References connect(), and reconnect().
|
static |
Function to fix problematic characters in DN's that are used for search requests. I.e. member=....
string | $dn | The DN |
Definition at line 118 of file class_ldap.inc.
rename_dn | ( | $source, | |
$dest | |||
) |
Move the given Ldap entry from $source to $dest.
String | $source | The source dn. |
String | $dest | The destination dn. |
Definition at line 564 of file class_ldap.inc.
References connect(), and reconnect().
resetResult | ( | $srp | ) |
Reset the result.
integer | $srp | Value to be reset |
Definition at line 421 of file class_ldap.inc.
Referenced by search().
rm | ( | $attrs = "" , |
|
$dn = "" |
|||
) |
Remove.
string | $attrs | Empty string |
string | $dn | Empty string |
Definition at line 496 of file class_ldap.inc.
References connect(), and reconnect().
rmdir | ( | $deletedn | ) |
Remove directory.
string | $deletedn | The DN to be deleted |
Definition at line 539 of file class_ldap.inc.
References connect(), and reconnect().
rmdir_recursive | ( | $srp, | |
$deletedn | |||
) |
Function rmdir_recursive.
Based on recursive_remove, adding two thing: full subtree remove, and delete own node.
$srp | srp | |
string | $deletedn | The dn to delete |
Definition at line 618 of file class_ldap.inc.
References cd(), connect(), DEBUG(), DEBUG_LDAP, fetch(), get_additional_error(), reconnect(), search(), and success().
Referenced by import_single_entry().
search | ( | $srp, | |
$filter, | |||
$attrs = array() , |
|||
$scope = 'subtree' |
|||
) |
Search about filter.
integer | $srp | srp |
string | $filter | The filter |
array | $attrs | |
string | $scope | Scope of the search: subtree/base/one |
Definition at line 248 of file class_ldap.inc.
References clearResult(), connect(), msg_dialog\display(), reconnect(), and resetResult().
Referenced by rmdir_recursive().
set_size_limit | ( | $size | ) |
success | ( | ) |
Success.
Definition at line 882 of file class_ldap.inc.
Referenced by add(), import_single_entry(), modify(), and rmdir_recursive().