accounts_ldap::_get_nextid was not returning a negative number for groups, which lead to accounts_ldap::save to return a positive account_id for groups, which messed up some stuff in setup ...

This commit is contained in:
Ralf Becker 2006-06-08 22:04:44 +00:00
parent 3f855b8df3
commit 767c42b43f

View File

@ -175,7 +175,7 @@ class accounts_backend
} }
} }
} }
if (!$data['account_id']) // new group if (!$data['account_id']) // new account
{ {
if (!($data['account_id'] = $data_utf8['account_id'] = $this->_get_nextid($is_group ? 'g' : 'u'))) if (!($data['account_id'] = $data_utf8['account_id'] = $this->_get_nextid($is_group ? 'g' : 'u')))
{ {
@ -214,7 +214,7 @@ class accounts_backend
//echo "<p>ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")</p>\n"; //echo "<p>ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")</p>\n";
// modifying or adding the entry // modifying or adding the entry
if ($old && !ldap_modify($this->ds,$dn,$to_write) || if ($old && !ldap_modify($this->ds,$dn,$to_write) ||
!$old && !ldap_add($this->ds,$dn,$to_write)) !$old && !@ldap_add($this->ds,$dn,$to_write))
{ {
$err = true; $err = true;
if (!$old && $is_group) if (!$old && $is_group)
@ -772,7 +772,7 @@ class accounts_backend
* *
* @internal * @internal
* @param $string $account_type='u' (optional, default to 'u') * @param $string $account_type='u' (optional, default to 'u')
* @return int/boolean interger account_id or false if none is free anymore * @return int/boolean integer account_id (negative for groups) or false if none is free anymore
*/ */
function _get_nextid($account_type='u') function _get_nextid($account_type='u')
{ {
@ -801,6 +801,6 @@ class accounts_backend
{ {
return False; return False;
} }
return $account_id; return $sign * $account_id;
} }
} }