Fix: La config LDAP accepte la liste des objectClass
This commit is contained in:
parent
79b28739ce
commit
6a365194bb
@ -1891,7 +1891,7 @@ class Adherent
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Retourne chaine dn dans l'annuaire LDAP
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
* \return array Tableau info des attributs
|
* \return array Tableau info des attributs
|
||||||
*/
|
*/
|
||||||
function _load_ldap_info()
|
function _load_ldap_info()
|
||||||
@ -1900,26 +1900,15 @@ class Adherent
|
|||||||
|
|
||||||
$info=array();
|
$info=array();
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == 'activedirectory')
|
// Object classes
|
||||||
{
|
$info["objectclass"]=split(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"user");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"inetOrgPerson");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Champs
|
// Champs
|
||||||
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
||||||
if ($this->nom && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
|
if ($this->nom && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
|
||||||
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
||||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
||||||
|
if ($this->pass && $conf->global->LDAP_FIELD_PASSWORD) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypté
|
||||||
if ($this->poste && $conf->global->LDAP_FIELD_TITLE) $info[$conf->global->LDAP_FIELD_TITLE] = $this->poste;
|
if ($this->poste && $conf->global->LDAP_FIELD_TITLE) $info[$conf->global->LDAP_FIELD_TITLE] = $this->poste;
|
||||||
if ($this->address && $conf->global->LDAP_FIELD_ADDRESS) $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
if ($this->address && $conf->global->LDAP_FIELD_ADDRESS) $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
|
||||||
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
||||||
|
|||||||
@ -220,27 +220,15 @@ class Contact
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Retourne chaine dn dand l'annuaire LDAP
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
* \return array Tableau info des attributs
|
* \return array Tableau info des attributs
|
||||||
*/
|
*/
|
||||||
function _load_ldap_info()
|
function _load_ldap_info()
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == 'activedirectory')
|
// Object classes
|
||||||
{
|
$info["objectclass"]=split(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"user");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"inetOrgPerson");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Champs
|
// Champs
|
||||||
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
||||||
@ -262,7 +250,7 @@ class Contact
|
|||||||
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
||||||
if ($this->ville && $conf->global->LDAP_FIELD_TOWN) $info[$conf->global->LDAP_FIELD_TOWN] = $this->ville;
|
if ($this->ville && $conf->global->LDAP_FIELD_TOWN) $info[$conf->global->LDAP_FIELD_TOWN] = $this->ville;
|
||||||
if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = $this->phone_pro;
|
if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = $this->phone_pro;
|
||||||
if ($this->phone_perso) $info["homePhone"] = $this->phone_perso;
|
if ($this->phone_perso && $conf->global->LDAP_FIELD_PHONE_PERSO) $info[$conf->global->LDAP_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||||
if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile;
|
if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile;
|
||||||
if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
|
if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
|
||||||
if ($this->note && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note;
|
if ($this->note && $conf->global->LDAP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class Ldap
|
|||||||
/**
|
/**
|
||||||
* Tableau des serveurs (IP addresses ou nom d'hôtes)
|
* Tableau des serveurs (IP addresses ou nom d'hôtes)
|
||||||
*/
|
*/
|
||||||
var $server;
|
var $server=array();
|
||||||
/**
|
/**
|
||||||
* Base DN (e.g. "dc=foo,dc=com")
|
* Base DN (e.g. "dc=foo,dc=com")
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,7 @@ class Ldap
|
|||||||
*/
|
*/
|
||||||
var $domain;
|
var $domain;
|
||||||
/**
|
/**
|
||||||
* Administrateur Ldap
|
* User administrateur Ldap
|
||||||
* Active Directory ne supporte pas les connexions anonymes
|
* Active Directory ne supporte pas les connexions anonymes
|
||||||
*/
|
*/
|
||||||
var $searchUser;
|
var $searchUser;
|
||||||
@ -112,7 +112,8 @@ class Ldap
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
//Server
|
//Server
|
||||||
$this->server = array($conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_HOST_SLAVE);
|
if ($conf->global->LDAP_SERVER_HOST) $this->server[] = $conf->global->LDAP_SERVER_HOST;
|
||||||
|
if ($conf->global->LDAP_SERVER_HOST_SLAVE) $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
|
||||||
$this->serverPort = $conf->global->LDAP_SERVER_PORT;
|
$this->serverPort = $conf->global->LDAP_SERVER_PORT;
|
||||||
$this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION;
|
$this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION;
|
||||||
$this->dn = $conf->global->LDAP_SERVER_DN;
|
$this->dn = $conf->global->LDAP_SERVER_DN;
|
||||||
@ -666,9 +667,17 @@ class Ldap
|
|||||||
$fp=fopen($file,"w");
|
$fp=fopen($file,"w");
|
||||||
if ($fp)
|
if ($fp)
|
||||||
{
|
{
|
||||||
fputs($fp,"# ldapadd -c -v -D cn=Manager,dc=my-domain,dc=com -W -f ldapinput.in\n");
|
if (ereg('^ldap',$this->server[0]))
|
||||||
fputs($fp,"# ldapmodify -c -v -D cn=Manager,dc=my-domain,dc=com -W -f ldapinput.in\n");
|
{
|
||||||
fputs($fp,"# ldapdelete -c -v -D cn=Manager,dc=my-domain,dc=com -W -f ldapinput.in\n");
|
$target="-H ".join(',',$this->server);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$target="-h ".join(',',$this->server)." -p ".$this->serverPort;
|
||||||
|
}
|
||||||
|
fputs($fp,"# ldapadd $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||||
|
fputs($fp,"# ldapmodify $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||||
|
fputs($fp,"# ldapdelete $target -c -v -D ".$this->searchUser." -W -f ldapinput.in\n");
|
||||||
fputs($fp, "dn: ".$dn."\n");
|
fputs($fp, "dn: ".$dn."\n");
|
||||||
foreach($info as $key => $value)
|
foreach($info as $key => $value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1283,7 +1283,7 @@ class User
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Retourne chaine dn dand l'annuaire LDAP
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
* \return array Tableau info des attributs
|
* \return array Tableau info des attributs
|
||||||
*/
|
*/
|
||||||
function _load_ldap_info()
|
function _load_ldap_info()
|
||||||
@ -1292,20 +1292,8 @@ class User
|
|||||||
|
|
||||||
$info=array();
|
$info=array();
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == 'activedirectory')
|
// Object classes
|
||||||
{
|
$info["objectclass"]=split(',',$conf->global->LDAP_USER_OBJECT_CLASS);
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"user");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"inetOrgPerson");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Champs
|
// Champs
|
||||||
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
if ($this->fullname && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
|
||||||
@ -1313,6 +1301,7 @@ class User
|
|||||||
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
||||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
||||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN_SAMBA) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login;
|
if ($this->login && $conf->global->LDAP_FIELD_LOGIN_SAMBA) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login;
|
||||||
|
if ($this->pass && $conf->global->LDAP_FIELD_PASSWORD) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypté
|
||||||
if ($this->poste) $info["title"] = $this->poste;
|
if ($this->poste) $info["title"] = $this->poste;
|
||||||
if ($this->societe_id > 0)
|
if ($this->societe_id > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -479,7 +479,7 @@ class UserGroup
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Retourne chaine dn dand l'annuaire LDAP
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
* \return array Tableau info des attributs
|
* \return array Tableau info des attributs
|
||||||
*/
|
*/
|
||||||
function _load_ldap_info()
|
function _load_ldap_info()
|
||||||
@ -487,20 +487,8 @@ class UserGroup
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
$info=array();
|
$info=array();
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == 'activedirectory')
|
// Object classes
|
||||||
{
|
$info["objectclass"]=split(',',$conf->global->LDAP_GROUP_OBJECT_CLASS);
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"user");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$info["objectclass"]=array("top",
|
|
||||||
"person",
|
|
||||||
"organizationalPerson",
|
|
||||||
"inetOrgPerson");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Champs
|
// Champs
|
||||||
if ($this->nom && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->nom;
|
if ($this->nom && $conf->global->LDAP_FIELD_FULLNAME) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->nom;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user