Fix: ldap

This commit is contained in:
Regis Houssin 2009-12-21 11:12:57 +00:00
parent 9badafe497
commit 35db04e1b5
3 changed files with 9 additions and 11 deletions

View File

@ -855,9 +855,7 @@ class Ldap
* Returns an array containing attributes and values for first record
*/
function getAttribute($dn,$filter)
{
print $dn.'<br>';
{
// Check parameters
if (! $this->connection)
{

View File

@ -32,6 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
$langs->load("companies");
$langs->load("ldap");
$langs->load("users");
// Protection quand utilisateur externe
$contactid = isset($_GET["id"])?$_GET["id"]:'';
@ -173,9 +174,9 @@ if ($result > 0)
$info=$fgroup->_load_ldap_info();
$dn=$fgroup->_load_ldap_dn($info,1);
$search = "(".$fgroup->_load_ldap_dn($info,2).")";
$records=$ldap->search($dn,$search);
$records = $ldap->getAttribute($dn,$search);
//print_r($records);
//var_dump($records);
// Affichage arbre
if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0))
@ -186,7 +187,7 @@ if ($result > 0)
}
else
{
$result=show_ldap_content($records,0,0,true);
$result=show_ldap_content($records,0,$records['count'],true);
}
}
else

View File

@ -45,7 +45,7 @@ class UserGroup extends CommonObject
var $note; // Note on group
var $datec; // Creation date of group
var $datem; // Modification date of group
var $members=array(); // Array of users
var $members=array(1,2,18); // Array of users
var $oldcopy; // To contains a clone of this when we need to save old properties of object
@ -564,7 +564,7 @@ class UserGroup extends CommonObject
if ($this->note && $conf->global->LDAP_GROUP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = $this->note;
if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)
{
$valueofldapfield='';
$valueofldapfield=array();
foreach($this->members as $key=>$val)
{
$muser=new User($this->db);
@ -573,9 +573,8 @@ class UserGroup extends CommonObject
$ldapuserid=$muser->login;
// TODO ldapuserid should depends on value $conf->global->LDAP_KEY_USERS;
if ($valueofldapfield) $valueofldapfield.=' ';
$valueofldapfield.=$conf->global->LDAP_KEY_USERS.'='.$ldapuserid.','.$conf->global->LDAP_USER_DN;
$valueofldapfield[] = $conf->global->LDAP_KEY_USERS.'='.$ldapuserid.','.$conf->global->LDAP_USER_DN;
}
$info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = $valueofldapfield;
}