mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
Fixes for get_next_id() and exists()
This commit is contained in:
parent
a4a65ffcd5
commit
4d676d8259
@ -519,7 +519,8 @@
|
||||
|
||||
if(gettype($account) == 'integer')
|
||||
{
|
||||
$ldapname = 'cn';
|
||||
$ldapgroup = 'gidnumber';
|
||||
$ldapacct = 'uidnumber';
|
||||
/* If data is cached, use it. */
|
||||
if(@isset($by_id[$account]))
|
||||
{
|
||||
@ -528,7 +529,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$ldapname = 'gidnumber';
|
||||
$ldapgroup = 'cn';
|
||||
$ldapacct = 'uid';
|
||||
/* If data is cached, use it. */
|
||||
if(@isset($by_lid[$account]))
|
||||
{
|
||||
@ -537,14 +539,14 @@
|
||||
}
|
||||
|
||||
$ds = $GLOBALS['phpgw']->common->ldapConnect();
|
||||
$acct_type = $this->get_type($account_id);
|
||||
$acct_type = $this->get_type($account);
|
||||
|
||||
if ($acct_type == 'g' && $this->group_context)
|
||||
{
|
||||
$sri = ldap_search($ds, $this->group_context, $ldapname . '=' . $account);
|
||||
$sri = ldap_search($ds, $this->group_context, $ldapgroup . '=' . $account);
|
||||
$groups = ldap_get_entries($ds, $sri);
|
||||
}
|
||||
$sri = ldap_search($ds, $this->user_context, 'uid=' . $account);
|
||||
$sri = ldap_search($ds, $this->user_context, $ldapacct . '=' . $account);
|
||||
$users = ldap_get_entries($ds, $sri);
|
||||
|
||||
if ($users[0]['dn'])
|
||||
@ -556,7 +558,7 @@
|
||||
$in += 2;
|
||||
}
|
||||
/* This sets up internal caching for this function */
|
||||
if($ldapname == 'gidnumber')
|
||||
if($ldapgroup == 'gidnumber')
|
||||
{
|
||||
$by_id[$account] = $in;
|
||||
$by_lid[$this->id2name($account)] = $in;
|
||||
|
@ -131,8 +131,8 @@
|
||||
*/
|
||||
function get_nextid($account_type='u')
|
||||
{
|
||||
if ($GLOBALS['phpgw_info']['server']['account_min_id']) { $min = $GLOBALS['phpgw_info']['server']['account_min_id']; }
|
||||
if ($GLOBALS['phpgw_info']['server']['account_max_id']) { $max = $GLOBALS['phpgw_info']['server']['account_max_id']; }
|
||||
$min = $GLOBALS['phpgw_info']['server']['account_min_id'] ? $GLOBALS['phpgw_info']['server']['account_min_id'] : 0;
|
||||
$max = $GLOBALS['phpgw_info']['server']['account_max_id'] ? $GLOBALS['phpgw_info']['server']['account_max_id'] : 0;
|
||||
|
||||
if ($account_type == 'g')
|
||||
{
|
||||
@ -142,23 +142,25 @@
|
||||
{
|
||||
$type = 'accounts';
|
||||
}
|
||||
$nextid = $GLOBALS['phpgw']->common->last_id($type,$min,$max);
|
||||
$nextid = intval($GLOBALS['phpgw']->common->last_id($type,$min,$max));
|
||||
|
||||
/* Loop until we find a free id */
|
||||
$free = 0;
|
||||
while (!$free)
|
||||
{
|
||||
$account_lid = '';
|
||||
//echo '<br>calling search for id: '.$nextid;
|
||||
if ($this->exists($nextid))
|
||||
{
|
||||
$nextid = $GLOBALS['phpgw']->common->next_id($type,$min,$max);
|
||||
$nextid = intval($GLOBALS['phpgw']->common->next_id($type,$min,$max));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* echo '<br>calling search for lid: '.$account_lid; */
|
||||
$account_lid = $this->id2name($nextid);
|
||||
/* echo '<br>calling search for lid: '.$account_lid . '(from account_id=' . $nextid . ')'; */
|
||||
if ($this->exists($account_lid))
|
||||
{
|
||||
$nextid = $GLOBALS['phpgw']->common->next_id($type,$min,$max);
|
||||
$nextid = intval($GLOBALS['phpgw']->common->next_id($type,$min,$max));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user