Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /home/inri/public_html/daCode-HEAD/daCode/src/phplib/ldap.php3
daCode -

Ldap

Ldap

Class to manage a dacode ldap users

 

private class Ldap

Class to manage a dacode ldap users
ldap.inc - version 1.1

Copyright (C) 1998 Eric Kilfoil eric@ipass.net

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

The author can be reached at eric@ypass.net

daCode http://www.dacode.org/
src/phplib/ldap.php3

$Id: ldap.php3,v 1.12 2002/05/13 21:34:02 jbcombes Exp $
Adapted by Pascal Pucci Pascal@deenoo.com for daCode
April 2001

FIXME: cleanup necessary

AuthorsEric Kilfoil <eric@ipass.net>

 

Public Method Summary

void

Ldap([ string $binddn, string $bindpw, string $hostname ])

Class constructor
void

setLDAPHost(string $hostname)

Sets hostname of LDAP server, never used
string

getLDAPHost(string $hostname)

Returns hostname of LDAP server, never used
void

setBindDN(string $binddn)

sets distinguished name for the bind
string

getBindDN(string $binddn)

Returns distinguished name for the bind
void

setBaseDN(string $basedn)

Sets base distinguished name
string

getBaseDN(string $basedn)

Returns base distinguished name
void

setBindPassword(string $bindpw)

Sets bind password
string

getBindPassword(string $bindpw)

Returns bind password
void

cd(string $dir)

Sets current directory to $dir
string

getParentDir([ string $basedn ])

Returns the name of the parent level in LDAP hierarchy.
void

disconnect()

Closes the connexion to the LDAP server, never used?!
integer

search(string $filter)

Performs a search in the directory.
void

ls([ string $filter, string $basedn ])

Lists all objects at the current level of LDAP hierarchy., never used
integer

cat(string $dn)

Read an entry in the directory, never used
array

fetch()

Fetches an entry in the current result set.
void

resetResult()

resets the array of results
string

getDN()

Gets dn of current result entry
void

count()

Counts the number of entries in result set
boolean

mkdir(string $attrname, string $dirname, [ string $basedn ])

Add a new entry in directory of objectClass top
boolean

rm([ mixed $attrs, string $dn ])

Deletes attributes of entry
boolean

rename(array $attrs, [ string $dn ])

Replaces attributes for specified DN
boolean

rmdir(string $deletedn)

Deletes an entry form directory
boolean

modify(string $attrs)

Modifies the current entry

Private Method Summary

void

readConfiguration([ string $OCconfigFilePath ])

Reads the LDAP config (Objects definitions)?
array

getObjectClasses()

Returns an array of classes.
void

isObjectClass(string $ocname)

Determines wether the object class has been defined in LDAP config
array

getAllows(string $ocname)

Gets some properties of object class
array

getRequires(string $ocname)

Gets some properties of object class
boolean

isAllowed(string $ocname, string $allowed)

Gets some properties of object class, never used
array

isRequired(string $ocname, string $required)

Gets some properties of object class, never used
integer

connect(string $binddn, string $bindpw, string $hostname)

Conects to the LDAP server

Private Field Summary

unknown

$hostname

unknown

$basedn

unknown

$binddn

unknown

$bindpw

unknown

$OCconfigFilePath

integer

$cid

integer

$bid

integer

$sr

integer

$re

string

$error

integer

$start

array

$objectClasses

Public Method Details

Ldap

public void Ldap( [ string $binddn, string $bindpw, string $hostname ] )

  Class constructor

Parameter
string $binddn = >>""<<
dn for the bind (kind of username)
string $bindpw = >>""<<
passwd used for the bind
string $hostname = >>""<<
hostname of the LDAP server
Returns void


setLDAPHost

public void setLDAPHost( string $hostname )

  Sets hostname of LDAP server, never used

Parameter
string $hostname
Returns void


getLDAPHost

public string getLDAPHost( string $hostname )

  Returns hostname of LDAP server, never used

Parameter
string $hostname
an accessor?????
Returns string


setBindDN

public void setBindDN( string $binddn )

  sets distinguished name for the bind

Parameter
string $binddn
Returns void


getBindDN

public string getBindDN( string $binddn )

  Returns distinguished name for the bind

Parameter
string $binddn
an accessor?????
Returns string


setBaseDN

public void setBaseDN( string $basedn )

  Sets base distinguished name

Parameter
string $basedn
Returns void


getBaseDN

public string getBaseDN( string $basedn )

  Returns base distinguished name

Parameter
string $basedn
an accessor?????
Returns string


setBindPassword

public void setBindPassword( string $bindpw )

  Sets bind password

Parameter
string $bindpw
Returns void


getBindPassword

public string getBindPassword( string $bindpw )

  Returns bind password

Parameter
string $bindpw
an accessor?????
Returns string


cd

public void cd( string $dir )

  Sets current directory to $dir

Parameter
string $dir
Returns void


getParentDir

public string getParentDir( [ string $basedn ] )

  Returns the name of the parent level in LDAP hierarchy.

Parameter
string $basedn = >>""<<
to compute parent.
Returns string


disconnect

public void disconnect( )

  Closes the connexion to the LDAP server, never used?!

Returns void


search

public integer search( string $filter )

  Performs a search in the directory.
This is quite poorly written...

Parameter
string $filter
filter for the search
Returns integer

a search result identifier or 0 on failure.


ls

public void ls( [ string $filter, string $basedn ] )

  Lists all objects at the current level of LDAP hierarchy., never used

Parameter
string $filter = >>"(objectclass=*)"<<
filter for the search
string $basedn = >>""<<
base dn to use, if not the current one.
Returns void


cat

public integer cat( string $dn )

  Read an entry in the directory, never used

Parameter
string $dn
dn of the object
Returns integer

a search result identifier or 0 on error.


fetch

public array fetch( )

  Fetches an entry in the current result set.

Returns array

the attributes of the entry


resetResult

public void resetResult( )

  resets the array of results

Returns void


getDN

public string getDN( )

  Gets dn of current result entry

Returns string


count

public void count( )

  Counts the number of entries in result set

Returns void


mkdir

public boolean mkdir( string $attrname, string $dirname, [ string $basedn ] )

  Add a new entry in directory of objectClass top

Parameter
string $attrname
of the attribute (for the DN)
string $dirname
of the entry (for the DN)
string $basedn = >>""<<
where to add entry
Returns boolean

true on success


rm

public boolean rm( [ mixed $attrs, string $dn ] )

  Deletes attributes of entry

Parameter
mixed $attrs = >>""<<
or empty string
string $dn = >>""<<
entry (default: current entry)
Returns boolean

true on success


rename

public boolean rename( array $attrs, [ string $dn ] )

  Replaces attributes for specified DN
Wrapper for ldap_mod_replace

Parameter
array $attrs
arrtibutes to set
string $dn = >>""<<
dn; current one if empty.
Returns boolean

true on success


rmdir

public boolean rmdir( string $deletedn )

  Deletes an entry form directory

Parameter
string $deletedn
to delete. NO DEFAULT
Returns boolean

true on success


modify

public boolean modify( string $attrs )

  Modifies the current entry

Parameter
string $attrs
Returns boolean

true on success


Private Method Details

readConfiguration

private void readConfiguration( [ string $OCconfigFilePath ] )

  Reads the LDAP config (Objects definitions)?
Parses the file and put it into objectClasses array.
Calls echo to display an error message if unable to read file.

Parameter
string $OCconfigFilePath = >>""<<
path to LDAP classes definitions.
Returns void


getObjectClasses

private array getObjectClasses( )

  Returns an array of classes.
private? Not used anytwhere...

Returns array


isObjectClass

private void isObjectClass( string $ocname )

  Determines wether the object class has been defined in LDAP config

Parameter
string $ocname
name of the object class.
@retrun boolean
Returns void


getAllows

private array getAllows( string $ocname )

  Gets some properties of object class
FIXME: Not used anywhere?

Parameter
string $ocname
name of the obj. class
Returns array

the property


getRequires

private array getRequires( string $ocname )

  Gets some properties of object class
FIXME: not used anywhere

Parameter
string $ocname
name of the obj. class
Returns array

the property


isAllowed

private boolean isAllowed( string $ocname, string $allowed )

  Gets some properties of object class, never used

Parameter
string $ocname
name of the obj. class
string $allowed
????
Returns boolean

the property


isRequired

private array isRequired( string $ocname, string $required )

  Gets some properties of object class, never used

Parameter
string $ocname
name of the obj. class
string $required
????
Returns array

the property


connect

private integer connect( string $binddn, string $bindpw, string $hostname )

  Conects to the LDAP server
Calss echo if fails.

Parameter
string $binddn
name for the bind
string $bindpw
password
string $hostname
of LDAP server
Returns integer

a bind ID on success, an error code on failure.


Private Field Details

$hostname

private unknown $hostname

>><<



$basedn

private unknown $basedn

>><<



$binddn

private unknown $binddn

>><<



$bindpw

private unknown $bindpw

>><<



$OCconfigFilePath

private unknown $OCconfigFilePath

>><<



$cid

private integer $cid

>><<



$bid

private integer $bid

>><<



$sr

private integer $sr

>><<



$re

private integer $re

>><<



$error

private string $error

>>""<<



$start

private integer $start

>><<



$objectClasses

private array $objectClasses

>>array()<<




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta