fixed RID

This commit is contained in:
Roland Gruber 2005-05-10 15:02:58 +00:00
parent 1f3b8614b0
commit fe48b1f53f
1 changed files with 33 additions and 53 deletions

View File

@ -491,35 +491,18 @@ class sambaAccount extends baseModule {
* it's psssible uidNumber has changed
*/
$special = false;
if ($this->attributes['rid'][0] == "500") $special = true;
if ($this->attributes['rid'][0] == "501") $special = true;
if ($this->attributes['rid'][0] == "515") $special = true;
if ($this->attributes['rid'][0] < 1000) $special = true;
if (!$special) $this->attributes['rid'][0] == $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
$rids = array_keys($this->rids);
$rids = array_values($this->rids);
$wrid = false;
for ($i=0; $i<count($rids); $i++)
if ($this->attributes['primaryGroupID'][0] == $rids[$i])
for ($i=0; $i<count($rids); $i++) {
if ($this->attributes['primaryGroupID'][0] == $rids[$i]) {
$wrid = true;
break;
}
}
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig);
// Set password
if (isset($return[$_SESSION[$this->base]->dn]['modify']['lmPassword']))
unset($return[$_SESSION[$this->base]->dn]['modify']['lmPassword']);
if (isset($return[$_SESSION[$this->base]->dn]['modify']['ntPassword']))
unset($return[$_SESSION[$this->base]->dn]['modify']['ntPassword']);
if (!isset($this->orig['lmPassword'][0])) {
$return[$_SESSION[$this->base]->dn]['modify']['lmPassword'][0] = lmPassword($this->lmPassword());
$return[$_SESSION[$this->base]->dn]['modify']['ntPassword'][0] = ntPassword($this->lmPassword());
$return[$_SESSION[$this->base]->dn]['modify']['pwdLastSet'][0] = time();
}
if ($this->lmPassword()!='') {
$return[$_SESSION[$this->base]->dn]['modify']['lmPassword'][0] = lmPassword($this->lmPassword());
$return[$_SESSION[$this->base]->dn]['modify']['ntPassword'][0] = ntPassword($this->lmPassword());
$return[$_SESSION[$this->base]->dn]['modify']['pwdLastSet'][0] = time();
}
return $return;
}
@ -589,6 +572,7 @@ class sambaAccount extends baseModule {
if ($post['primaryGroupID'] == $rids[$i]) {
$wrid = true;
$this->attributes['primaryGroupID'][0] = $this->rids[$rids[$i]];
break;
}
}
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
@ -604,17 +588,13 @@ class sambaAccount extends baseModule {
else $this->lmPassword($post['lmPassword']);
}
}
if ($post['rid']== _('Administrator')) {
$this->attributes['rid'][0] = "500";
// Do a check if an administrator already exists
if ($_SESSION['cache']->in_cache("500", 'rid', 'user')!=$_SESSION[$this->base]->dn_orig)
$triggered_messages['rid'][] = $this->messages['rid'][0];
// rid
$specialNames = array_keys($this->rids);
if (in_array($post['rid'], $specialNames)) {
$this->attributes['rid'][0] = $this->rids[$post['rid']];
}
if ($post['rid']== _('Guest')) {
$this->attributes['rid'][0] = "501";
// Do a check if an administrator already exists
if ($_SESSION['cache']->in_cache("501", 'rid', 'user')!=$_SESSION[$this->base]->dn_orig)
$triggered_messages['rid'][] = $this->messages['rid'][1];
else {
$this->attributes['rid'][0] = $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
}
$this->attributes['smbHome'][0] = str_replace('$user', $_SESSION[$this->base]->module['inetOrgPerson']->attributes['uid'][0], $this->attributes['smbHome'][0]);
$this->attributes['smbHome'][0] = str_replace('$group', $_SESSION[$this->base]->module['inetOrgPerson']->attributes['gid'][0], $this->attributes['smbHome'][0]);
@ -783,9 +763,11 @@ class sambaAccount extends baseModule {
2 => array ( 'kind' => 'help', 'value' => 'userWorkstations' ));
$names = array_keys($this->rids);
$wrid=false;
$options = array();
$selected = array();
$wrid = false;
for ($i=0; $i<count($names); $i++) {
if ($this->attributes['primaryGroupID'][0]==$this->rids[$names[$i]]) {
if ($this->attributes['primaryGroupID'][0] == $this->rids[$names[$i]]) {
$selected[] = $names[$i];
$wrid=true;
}
@ -796,18 +778,16 @@ class sambaAccount extends baseModule {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
1 => array ( 'kind' => 'select', 'name' => 'primaryGroupID', 'options' => $options, 'options_selected' => $selected),
2 => array ( 'kind' => 'help', 'value' => 'primaryGroupID' ));
// Display if group SID should be mapped to a well kown SID
$wrid=false;
if ($this->attributes['rid'][0]=="500") {
$selected[] = _('Administrator');
$options = array();
$selected = array();
$wrid = false;
for ($i=0; $i<count($names); $i++) {
if ($this->attributes['rid'][0] == $this->rids[$names[$i]]) {
$selected[] = $names[$i];
$wrid=true;
}
else $options[] = _('Administrator');
if ($this->attributes['rid'][0]=="501") {
$selected[] = _('Guest');
$wrid=true;
else $options[] = $names[$i];
}
else $options[] = _('Guest');
if ($wrid) $options[] = "-";
else $selected[] = "-";
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Special user') ),