From 29780c98c0318060af3b8880d2c1512abe2fd580 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 19 Mar 2006 11:25:57 +0000 Subject: [PATCH] added primary group to profile --- lam/HISTORY | 3 ++- lam/lib/modules/sambaSamAccount.inc | 32 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/lam/HISTORY b/lam/HISTORY index a7afc543..624b34bc 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,9 +1,10 @@ ??? 1.0.1 - LAM can now be installed with "configure" and "make install" - - Samba 3: readded time zone selection for logon hours - Unix: merged password hash settings for Unix users and groups + - Samba 3: added Windows group to profile options - fixed bugs: -> Samba 3: hash values were wrong in some rare cases (1440021) + -> Samba 3: readded time zone selection for logon hours (1407761) -> Unix: call of unknown function (1450464) diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 3caa51e0..7975da0a 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -809,7 +809,7 @@ class sambaSamAccount extends baseModule { } elseif ($this->attributes['sambaDomainName'][0]!='') { if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) { - $SID = $domainSID; + $SID = $sambaDomains[$i]->SID; $sel_domain = $sambaDomains[$i]->name; } } @@ -1149,6 +1149,17 @@ class sambaSamAccount extends baseModule { 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()), 2 => array('kind' => 'help', 'value' => 'domain') ); + // Windows group + $groups = array(); + foreach ($this->rids as $key => $value) { + $groups[] = array($value, $key); + } + $groups[] = array("-", "-"); + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Windows group') . ': '), + 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_group', 'options' => $groups, 'options_selected' => array('513'), 'descriptiveOptions' => true), + 2 => array('kind' => 'help', 'value' => 'group') + ); // logon hours $return[] = array( 0 => array('kind' => 'text', 'text' => _('Logon hours') . ': '), @@ -1243,6 +1254,25 @@ class sambaSamAccount extends baseModule { } } } + // primary group + if (isset($profile['sambaSamAccount_sambaDomainName'][0])) { + $domains = search_domains(); + $domSID = ''; + // find domain SID + for ($i = 0; $i < sizeof($domains); $i++) { + if ($domains[$i]->name == $profile['sambaSamAccount_sambaDomainName'][0]) { + $domSID = $domains[$i]->SID; + break; + } + } + if ($domSID != '') { + // set primary group if selected + if (isset($profile['sambaSamAccount_group'][0]) && ($profile['sambaSamAccount_group'][0] != "-")) { + $this->attributes['sambaPrimaryGroupSID'][0] = $domSID . "-" . $profile['sambaSamAccount_group'][0]; + } + } + + } } /**