mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
again some ldap fixes
and support for ldap version 3
This commit is contained in:
parent
844c7ead96
commit
c579775999
@ -356,6 +356,9 @@
|
||||
{
|
||||
$allValues = ldap_get_entries($this->ds, $sri);
|
||||
// if the user is not member of this group, add him
|
||||
if(is_array($allValues[0]['memberuid']))
|
||||
{
|
||||
// this group has already some members
|
||||
if(!in_array($newData['uid'],$allValues[0]['memberuid']))
|
||||
{
|
||||
$dn = $allValues[0]['dn'];
|
||||
@ -367,6 +370,15 @@
|
||||
ldap_mod_replace($this->ds, $dn, $newData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// this group has no members
|
||||
$dn = $allValues[0]['dn'];
|
||||
$newData = array();
|
||||
$newData['memberuid'][] = $accountID;
|
||||
ldap_mod_replace($this->ds, $dn, $newData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -765,6 +777,11 @@
|
||||
$entry['homedirectory'] = $account_info['homedirectory'] && $account_info['homedirectory'] != $GLOBALS['phpgw_info']['server']['ldap_account_home'] ? $account_info['homedirectory'] : $GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid'];
|
||||
$entry['loginshell'] = $account_info['loginshell'] ? $account_info['loginshell'] : $GLOBALS['phpgw_info']['server']['ldap_account_shell'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$entry['homedirectory'] = '/home/'.$account_info['account_lid'];
|
||||
$entry['loginshell'] = '/bin/false';
|
||||
}
|
||||
|
||||
if ($allValues[0]['dn'])
|
||||
{
|
||||
@ -848,14 +865,7 @@
|
||||
|
||||
$entry['uid'] = $account_info['account_lid'];
|
||||
$entry['uidnumber'] = $account_id;
|
||||
if ($GLOBALS['phpgw_info']['server']['ldap_group_id'])
|
||||
{
|
||||
$entry['gidnumber'] = $GLOBALS['phpgw_info']['server']['ldap_group_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$entry['gidnumber'] = $account_id;
|
||||
}
|
||||
$entry['gidnumber'] = $account_info['account_primary_group'];
|
||||
$entry['userpassword'] = $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd']);
|
||||
$entry['objectclass'][0] = 'top';
|
||||
$entry['objectclass'][1] = 'person';
|
||||
@ -869,7 +879,7 @@
|
||||
$entry['phpgwaccountexpires'] = $account_info['account_expires'];
|
||||
}
|
||||
|
||||
/* _debug_array($entry);exit; */
|
||||
#_debug_array($entry);exit;
|
||||
|
||||
ldap_add($this->ds, $dn, $entry);
|
||||
}
|
||||
@ -881,11 +891,14 @@
|
||||
// search for the group
|
||||
$filter = 'gidnumber='.$value;
|
||||
$justThese = array('memberuid');
|
||||
$sri = ldap_search($this->ds, $this->group_context, 'gidnumber='.$value, $justThese);
|
||||
$sri = ldap_search($this->ds, $this->group_context, $filter, $justThese);
|
||||
if($sri)
|
||||
{
|
||||
$allValues = ldap_get_entries($this->ds, $sri);
|
||||
// if the user is not member of this group, add him
|
||||
if(is_array($allValues[0]['memberuid']))
|
||||
{
|
||||
// this group has already some members
|
||||
if(!in_array($account_info['account_lid'],$allValues[0]['memberuid']))
|
||||
{
|
||||
$dn = $allValues[0]['dn'];
|
||||
@ -898,6 +911,15 @@
|
||||
#print ldap_error($this->ds)."<br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// this group has no members
|
||||
$dn = $allValues[0]['dn'];
|
||||
$newData = array();
|
||||
$newData['memberuid'][] = $account_info['account_lid'];
|
||||
ldap_mod_replace($this->ds, $dn, $newData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($account_id && is_object($GLOBALS['phpgw']->preferences) && $default_prefs)
|
||||
|
@ -260,6 +260,11 @@
|
||||
return False;
|
||||
}
|
||||
|
||||
if($GLOBALS['phpgw_info']['server']['ldap_version3'])
|
||||
{
|
||||
ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);
|
||||
}
|
||||
|
||||
// bind as admin, we not to able to do everything
|
||||
if (! ldap_bind($ds,$dn,$passwd))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user