From d24db1b64506c23e1188b3c562bb8eb7c781a866 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 14 Dec 2011 18:41:59 +0000 Subject: [PATCH] added login shell to self service --- lam/lib/modules/posixAccount.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index bd721004..9ee52e66 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -145,7 +145,7 @@ class posixAccount extends baseModule implements passwordService { // self service search attributes $return['selfServiceSearchAttributes'] = array('uid'); // self service field settings - $return['selfServiceFieldSettings'] = array('password' => _('Password'), 'cn' => _('Common name')); + $return['selfServiceFieldSettings'] = array('password' => _('Password'), 'cn' => _('Common name'), 'loginShell' => _('Login shell')); // self service configuration settings $selfServiceContainer = new htmlTable(); $selfServiceContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', array("CRYPT", "SHA", "SSHA", "MD5", "SMD5", "PLAIN"), @@ -2085,6 +2085,14 @@ class posixAccount extends baseModule implements passwordService { new htmlTableExtendedInputField(_('Common name'), 'posixAccount_cn', $cn) )); } + if (in_array('loginShell', $fields)) { + $shelllist = getshells(); // list of all valid shells + $loginShell = ''; + if (isset($attributes['loginShell'][0])) $loginShell = $attributes['loginShell'][0]; + $return['loginShell'] = new htmlTableRow(array( + new htmlTableExtendedSelect('posixAccount_loginShell', $shelllist, array($loginShell), _('Login shell')) + )); + } return $return; } @@ -2144,6 +2152,12 @@ class posixAccount extends baseModule implements passwordService { $return['messages'][] = $this->messages['cn'][0]; } } + if (in_array('loginShell', $fields)) { + $shelllist = getshells(); // list of all valid shells + if (in_array($_POST['posixAccount_loginShell'], $shelllist)) { + $return['mod']['loginShell'][0] = $_POST['posixAccount_loginShell']; + } + } return $return; }