forked from extern/egroupware
* Sambaadmin: create new users/groups in LDAP with uidNumber/gidNumber matching relative id (last part of SID) to ease migration to AD or Samba4
This commit is contained in:
parent
b8ce46782c
commit
b9102b010c
@ -727,6 +727,7 @@ class accounts
|
|||||||
{
|
{
|
||||||
$this->backend->set_memberships($groups, $account_id);
|
$this->backend->set_memberships($groups, $account_id);
|
||||||
|
|
||||||
|
if (!$old_memberships) $old_memberships = array();
|
||||||
self::cache_invalidate(array_unique(array_merge(
|
self::cache_invalidate(array_unique(array_merge(
|
||||||
array($account_id),
|
array($account_id),
|
||||||
array_diff($old_memberships, $groups),
|
array_diff($old_memberships, $groups),
|
||||||
|
@ -1141,6 +1141,10 @@ class accounts_ldap
|
|||||||
$min = $this->frontend->config['account_min_id'] ? $this->frontend->config['account_min_id'] : 0;
|
$min = $this->frontend->config['account_min_id'] ? $this->frontend->config['account_min_id'] : 0;
|
||||||
$max = $this->frontend->config['account_max_id'] ? $this->frontend->config['account_max_id'] : 0;
|
$max = $this->frontend->config['account_max_id'] ? $this->frontend->config['account_max_id'] : 0;
|
||||||
|
|
||||||
|
// prefer ids above 1000 (below reserved for system users under AD or Linux),
|
||||||
|
// if that's possible within what is configured, or nothing is configured
|
||||||
|
if ($min < 1000 && (!$max || $max > 1000)) $min = 1000;
|
||||||
|
|
||||||
if ($account_type == 'g')
|
if ($account_type == 'g')
|
||||||
{
|
{
|
||||||
$type = 'groups';
|
$type = 'groups';
|
||||||
@ -1154,12 +1158,15 @@ class accounts_ldap
|
|||||||
/* Loop until we find a free id */
|
/* Loop until we find a free id */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$account_id = (int) $GLOBALS['egw']->common->next_id($type,$min,$max);
|
$account_id = (int) common::next_id($type,$min,$max);
|
||||||
}
|
}
|
||||||
while ($account_id && ($this->frontend->exists($sign * $account_id) || $this->frontend->exists(-1 * $sign * $account_id))); // check need to include the sign!
|
while ($account_id && ($this->frontend->exists($sign * $account_id) || // check need to include the sign!
|
||||||
|
$this->frontend->exists(-1 * $sign * $account_id) ||
|
||||||
|
// if sambaadmin is installed, call it to check there's not yet a relative id (last part of SID) with that number
|
||||||
|
// to ease migration to AD or Samba4
|
||||||
|
$GLOBALS['egw_info']['apps']['sambaadmin'] && ExecMethod2('sambaadmin.sosambaadmin.sidExists', $account_id)));
|
||||||
|
|
||||||
if (!$account_id || $this->frontend->config['account_max_id'] &&
|
if (!$account_id || $max && $account_id > $max)
|
||||||
$account_id > $this->frontend->config['account_max_id'])
|
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user