mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +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')
|
if(gettype($account) == 'integer')
|
||||||
{
|
{
|
||||||
$ldapname = 'cn';
|
$ldapgroup = 'gidnumber';
|
||||||
|
$ldapacct = 'uidnumber';
|
||||||
/* If data is cached, use it. */
|
/* If data is cached, use it. */
|
||||||
if(@isset($by_id[$account]))
|
if(@isset($by_id[$account]))
|
||||||
{
|
{
|
||||||
@ -528,7 +529,8 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ldapname = 'gidnumber';
|
$ldapgroup = 'cn';
|
||||||
|
$ldapacct = 'uid';
|
||||||
/* If data is cached, use it. */
|
/* If data is cached, use it. */
|
||||||
if(@isset($by_lid[$account]))
|
if(@isset($by_lid[$account]))
|
||||||
{
|
{
|
||||||
@ -537,14 +539,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ds = $GLOBALS['phpgw']->common->ldapConnect();
|
$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)
|
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);
|
$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);
|
$users = ldap_get_entries($ds, $sri);
|
||||||
|
|
||||||
if ($users[0]['dn'])
|
if ($users[0]['dn'])
|
||||||
@ -556,7 +558,7 @@
|
|||||||
$in += 2;
|
$in += 2;
|
||||||
}
|
}
|
||||||
/* This sets up internal caching for this function */
|
/* This sets up internal caching for this function */
|
||||||
if($ldapname == 'gidnumber')
|
if($ldapgroup == 'gidnumber')
|
||||||
{
|
{
|
||||||
$by_id[$account] = $in;
|
$by_id[$account] = $in;
|
||||||
$by_lid[$this->id2name($account)] = $in;
|
$by_lid[$this->id2name($account)] = $in;
|
||||||
|
@ -131,8 +131,8 @@
|
|||||||
*/
|
*/
|
||||||
function get_nextid($account_type='u')
|
function get_nextid($account_type='u')
|
||||||
{
|
{
|
||||||
if ($GLOBALS['phpgw_info']['server']['account_min_id']) { $min = $GLOBALS['phpgw_info']['server']['account_min_id']; }
|
$min = $GLOBALS['phpgw_info']['server']['account_min_id'] ? $GLOBALS['phpgw_info']['server']['account_min_id'] : 0;
|
||||||
if ($GLOBALS['phpgw_info']['server']['account_max_id']) { $max = $GLOBALS['phpgw_info']['server']['account_max_id']; }
|
$max = $GLOBALS['phpgw_info']['server']['account_max_id'] ? $GLOBALS['phpgw_info']['server']['account_max_id'] : 0;
|
||||||
|
|
||||||
if ($account_type == 'g')
|
if ($account_type == 'g')
|
||||||
{
|
{
|
||||||
@ -142,23 +142,25 @@
|
|||||||
{
|
{
|
||||||
$type = 'accounts';
|
$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 */
|
/* Loop until we find a free id */
|
||||||
$free = 0;
|
$free = 0;
|
||||||
while (!$free)
|
while (!$free)
|
||||||
{
|
{
|
||||||
|
$account_lid = '';
|
||||||
//echo '<br>calling search for id: '.$nextid;
|
//echo '<br>calling search for id: '.$nextid;
|
||||||
if ($this->exists($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
|
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))
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user