loading of domain setting from profile did not work

This commit is contained in:
Roland Gruber 2005-10-13 16:03:51 +00:00
parent 414365bf48
commit fcfbdec26a
2 changed files with 35 additions and 4 deletions

View File

@ -6,6 +6,7 @@
-> inetOrgPerson: fixed mobile number
-> Samba 2/3: passwords fixed for file uploads (1311561)
-> Samba 3: fixed logon hours (patch 1311915)
-> Samba 3: loading of domain setting from profile did not work
-> Quota: profile settings fixed

View File

@ -746,15 +746,24 @@ class sambaSamAccount extends baseModule {
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
return;
}
if ($this->attributes['sambaSID'][0]!='')
if ($this->attributes['sambaSID'][0]!='') {
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
}
for ($i=0; $i<count($sambaDomains); $i++ ) {
$sambaDomainNames[] = $sambaDomains[$i]->name;
if (isset($domainSID)) {
if ($domainSID == $sambaDomains[$i]->SID) {
$SID = $domainSID;
$sel_domain = $sambaDomains[$i]->name;
}
}
elseif ($this->attributes['sambaDomainName'][0]!='') {
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
$SID = $domainSID;
$sel_domain = $sambaDomains[$i]->name;
}
}
}
$canchangedate = getdate($this->attributes['sambaPwdCanChange'][0]);
$mustchangedate = getdate($this->attributes['sambaPwdMustChange'][0]);
$expiredate = getdate($this->attributes['sambaKickoffTime'][0]);
@ -1149,6 +1158,27 @@ class sambaSamAccount extends baseModule {
$profile['sambaSamAccount_expire_day'][0], $profile['sambaSamAccount_expire_yea'][0]);
$this->attributes['sambaKickoffTime'][0] = $date;
}
// domain -> change SID
if ($this->attributes['sambaSID'][0]) {
if (isset($profile['sambaSamAccount_sambaDomainName'][0]) && ($profile['sambaSamAccount_sambaDomainName'][0] != "")) {
$domains = search_domains($_SESSION['config']->get_Suffix('domain'));
$domSID = '';
// find domain SID
for ($i = 0; $i < sizeof($domains); $i++) {
if ($domains[$i]->name == $profile['sambaSamAccount_sambaDomainName'][0]) {
$domSID = $domains[$i]->SID;
break;
}
}
// replace domain part of SID
if ($domSID != '') {
$SID = $this->attributes['sambaSID'][0];
$rid = substr($SID, strrpos($SID, '-') + 1);
$SID = $domSID . '-' . $rid;
$this->attributes['sambaSID'][0] = $SID;
}
}
}
}
/**