From 2cf5aeea93718e6549f023a0e1a31362a3d544a4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 11 Apr 2004 13:07:24 +0000 Subject: [PATCH] updated profile options --- lam/lib/modules/posixGroup.inc | 7 +- lam/lib/modules/sambaAccount.inc | 75 ++++++++++++- lam/lib/modules/sambaGroupMapping.inc | 16 ++- lam/lib/modules/sambaSamAccount.inc | 147 ++++++++++++++------------ 4 files changed, 167 insertions(+), 78 deletions(-) diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 09f6ff32..48be8d27 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -585,12 +585,9 @@ class posixGroup { return $return; } + // posixGroup has no profile options function get_profileOptions() { - $return = array(); - $return[] = array (0 => array ( 'kind' => 'text', 'text' => _("Groupname")), - 1 => array ('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '20', 'maxlength' => '20'), - 2 => array ('kind' => 'help', 'value' => 'cn')); - return $return; + return array(); } // checks if the values of a new or modified profile are valid diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index e50dd538..b0d5c60f 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -608,9 +608,78 @@ class sambaAccount { function get_profileOptions() { $return = array(); - $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Domain') ), - 1 => array ( 'kind' => 'input', 'type' => 'text', 'name' => 'domain', 'size' => '20', 'maxlength' => '255', 'value' => $this->attributes['domain'][0]), - 2 => array ( 'kind' => 'help', 'value' => 'domain' )); + if ($_SESSION[$this->base]->type=='user') { + // set Unix password for Samba + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Use unix password') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaAccount_useunixpwd', 'type' => 'checkbox', 'checked' => true), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // set no password + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Use no password') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaAccount_acctFlagsN', 'type' => 'checkbox', 'checked' => false), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // password expiry + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Password does not expire') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaAccount_acctFlagsX', 'type' => 'checkbox', 'checked' => true), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // account deactivation + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Account is deactivated') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaAccount_acctFlagsD', 'type' => 'checkbox', 'checked' => false), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // drive letter + $drives = array(); + for ($i = 90; $i > 67; $i--) $drives[] = chr($i) . ':'; + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Home drive') . ': '), + 1 => array('kind' => 'select', 'name' => 'sambaAccount_homeDrive', 'options' => $drives, 'options_selected' => array ('Z:')), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // path to home directory + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Home path') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_smbHome', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // path to profile + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Profile path') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_profilePath', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // logon script + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Logon script') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_scriptPath', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // allowed workstations + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Samba workstations') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_userWorkstations', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // Samba domain + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Domain') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_domain', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + } + elseif ($_SESSION[$this->base]->type=='user') { + // Samba domain + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Domain') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaAccount_domain', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + } return $return; } diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 377d7982..6d372556 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -307,10 +307,18 @@ class sambaGroupMapping { function get_profileOptions() { $return = array(); - // TODO fill in correct domains - $return[] = array (0 => array ('kind' => 'text', 'text' => _('Domain')), - 1 => array ('kind' => 'select', 'name' => 'sambaDomainName', 'options' => $sambaDomainNames), - 2 => array ('kind' => 'help', 'value' => 'sambaDomainName' )); + // get list of domains + $sambaDomains = $_SESSION['ldap']->search_domains($_SESSION['config']->get_domainSuffix()); + $sambaDomainNames = array(); + for ($i = 0; $i < count($sambaDomains); $i++ ) { + // extract names + $sambaDomainNames[] = $sambaDomains[$i]->name; + } + // domain + $return[] = array ( + 0 => array('kind' => 'text', 'text' => _('Domain')), + 1 => array('kind' => 'select', 'name' => 'sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array ()), + 2 => array('kind' => 'help', 'value' => 'sambaDomainName' )); return $return; } diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 8b89f766..38bfe51b 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -623,73 +623,88 @@ class sambaSamAccount { function get_profileOptions() { $return = array(); - // use Unix password as Samba password - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Use unix password') . ': '), - 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_useunixpwd', 'type' => 'checkbox', 'checked' => true), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // use no password at all - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Use no password') . ': '), - 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsN', 'type' => 'checkbox', 'checked' => false), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // password never expires - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Password does not expire') . ': '), - 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsX', 'type' => 'checkbox', 'checked' => true), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // account deactivation - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Account is deactivated') . ': '), - 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsD', 'type' => 'checkbox', 'checked' => false), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // letter of home drive - $drives = array(); - for ($i = 90; $i > 67; $i--) $drives[] = chr($i) . ':'; - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Home drive') . ': '), - 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaHomeDrive', 'options' => $drives, 'options_selected' => array('Z:')), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // path to home directory - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Home path') . ': '), - 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaHomePath', 'size' => '20', 'maxlength' => '255', 'value' => ''), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // profile path - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Profile path') . ': '), - 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaProfilePath', 'size' => '20', 'maxlength' => '255', 'value' => ''), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // logon script - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Logon script') . ': '), - 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaLogonScript', 'size' => '20', 'maxlength' => '255', 'value' => ''), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // allowed workstations - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Samba workstations') . ': '), - 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaUserWorkstations', 'value' => ''), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); - // domains - $sambaDomains = $_SESSION['ldap']->search_domains($_SESSION['config']->get_domainSuffix()); - $sambaDomainNames = array(); - for ($i = 0; $i < count($sambaDomains); $i++) { - $sambaDomainNames[] = $sambaDomains[$i]->name; + if ($_SESSION[$this->base]->type=='user') { + // use Unix password as Samba password + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Use unix password') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_useunixpwd', 'type' => 'checkbox', 'checked' => true), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // use no password at all + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Use no password') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsN', 'type' => 'checkbox', 'checked' => false), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // password never expires + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Password does not expire') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsX', 'type' => 'checkbox', 'checked' => true), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // account deactivation + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Account is deactivated') . ': '), + 1 => array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsD', 'type' => 'checkbox', 'checked' => false), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // letter of home drive + $drives = array(); + for ($i = 90; $i > 67; $i--) $drives[] = chr($i) . ':'; + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Home drive') . ': '), + 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaHomeDrive', 'options' => $drives, 'options_selected' => array('Z:')), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // path to home directory + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Home path') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaHomePath', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // profile path + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Profile path') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaProfilePath', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // logon script + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Logon script') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaLogonScript', 'size' => '20', 'maxlength' => '255', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // allowed workstations + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Samba workstations') . ': '), + 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_sambaUserWorkstations', 'value' => ''), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + // domains + $sambaDomains = $_SESSION['ldap']->search_domains($_SESSION['config']->get_domainSuffix()); + $sambaDomainNames = array(); + for ($i = 0; $i < count($sambaDomains); $i++) { + $sambaDomainNames[] = $sambaDomains[$i]->name; + } + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Domain') . ': '), + 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); + } + elseif ($_SESSION[$this->base]->type=='host') { + // domains + $sambaDomains = $_SESSION['ldap']->search_domains($_SESSION['config']->get_domainSuffix()); + $sambaDomainNames = array(); + for ($i = 0; $i < count($sambaDomains); $i++) { + $sambaDomainNames[] = $sambaDomains[$i]->name; + } + $return[] = array( + 0 => array('kind' => 'text', 'text' => _('Domain') . ': '), + 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()), + 2 => array('kind' => 'help', 'value' => 'TODO') + ); } - $return[] = array( - 0 => array('kind' => 'text', 'text' => _('Domain') . ': '), - 1 => array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()), - 2 => array('kind' => 'help', 'value' => 'TODO') - ); return $return; }