diff options
author | Simon Rettberg | 2016-03-30 17:06:21 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-03-30 17:06:21 +0200 |
commit | 8b6365e254dd51a4d06ced950c5eeada2dccc20a (patch) | |
tree | 859906a25ece0b909981477b456e16382d94dfbd /modules/sysconfig | |
parent | [serversetup] Show red warning if no valid ip address has been set (diff) | |
download | slx-admin-8b6365e254dd51a4d06ced950c5eeada2dccc20a.tar.gz slx-admin-8b6365e254dd51a4d06ced950c5eeada2dccc20a.tar.xz slx-admin-8b6365e254dd51a4d06ced950c5eeada2dccc20a.zip |
[ldapauth] Add homedir conf to ldap wizard
Diffstat (limited to 'modules/sysconfig')
-rw-r--r-- | modules/sysconfig/addmodule_ldapauth.inc.php | 84 |
1 files changed, 76 insertions, 8 deletions
diff --git a/modules/sysconfig/addmodule_ldapauth.inc.php b/modules/sysconfig/addmodule_ldapauth.inc.php index 6cefbe58..0dad780b 100644 --- a/modules/sysconfig/addmodule_ldapauth.inc.php +++ b/modules/sysconfig/addmodule_ldapauth.inc.php @@ -145,13 +145,77 @@ class LdapAuth_CheckCredentials extends AddModule_Base 'fingerprint' => Request::post('fingerprint'), 'certificate' => Request::post('certificate', ''), 'prev' => 'LdapAuth_Start', - 'next' => 'LdapAuth_Finish' + 'next' => 'LdapAuth_HomeDir' )) ); } } +class LdapAuth_HomeDir extends AddModule_Base +{ + + private $searchbase; + + protected function preprocessInternal() + { + $this->searchbase = Request::post('searchbase'); + $somedn = Request::post('somedn', false); + if (!empty($somedn)) { + $i = stripos($somedn, $this->searchbase); + if ($i !== false) { + $this->searchbase = substr($somedn, $i, strlen($this->searchbase)); + } + } + } + + protected function renderInternal() + { + $data = array( + 'edit' => Request::post('edit'), + 'title' => Request::post('title'), + 'server' => Request::post('server'), + 'searchbase' => $this->searchbase, + 'binddn' => Request::post('binddn'), + 'bindpw' => Request::post('bindpw'), + 'home' => Request::post('home'), + 'homeattr' => Request::post('homeattr'), + 'ssl' => Request::post('ssl') === 'on', + 'fingerprint' => Request::post('fingerprint'), + 'certificate' => Request::post('certificate', ''), + 'originalbinddn' => Request::post('originalbinddn'), + 'prev' => 'LdapAuth_Start', + 'next' => 'LdapAuth_Finish' + ); + if ($this->edit !== false) { + foreach (self::getAttributes() as $key) { + if ($this->edit->getData($key)) { + $data[$key . '_c'] = 'checked="checked"'; + } + } + $data['shareRemapMode_' . $this->edit->getData('shareRemapMode')] = 'selected="selected"'; + $letter = $this->edit->getData('shareHomeDrive'); + } else { + $data['shareDownloads'] = $data['shareMedia'] = $data['shareDocuments'] = 'selected="selected"'; + $letter = 'H:'; + } + $data['drives'] = array(); + foreach (range('D', 'Z') as $l) { + $data['drives'][] = array( + 'drive' => $l . ':', + 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : '' + ); + } + Render::addDialog(Dictionary::translate('config-module', 'ldapAuth_title'), false, 'sysconfig/ad_ldap-homedir', $data); + } + + public static function getAttributes() + { + return array('shareRemapMode', 'shareRemapCreate', 'shareDocuments', 'shareDownloads', 'shareDesktop', 'shareMedia', 'shareOther', 'shareHomeDrive'); + } + +} + class LdapAuth_Finish extends AddModule_Base { @@ -168,13 +232,6 @@ class LdapAuth_Finish extends AddModule_Base $module = ConfigModule::getInstance('LdapAuth'); else $module = $this->edit; - $somedn = Request::post('somedn', false); - if (!empty($somedn)) { - $i = stripos($somedn, $searchbase); - if ($i !== false) { - $searchbase = substr($somedn, $i, strlen($searchbase)); - } - } $ssl = Request::post('ssl', 'off') === 'on'; $module->setData('server', Request::post('server')); $module->setData('searchbase', $searchbase); @@ -183,6 +240,17 @@ class LdapAuth_Finish extends AddModule_Base $module->setData('home', Request::post('home')); $module->setData('certificate', Request::post('certificate')); $module->setData('ssl', $ssl); + foreach (LdapAuth_HomeDir::getAttributes() as $key) { + $value = Request::post($key); + if (is_numeric($value)) { + settype($value, 'integer'); + } elseif ($value === 'on') { + $value = 1; + } elseif ($value === false) { + $value = 0; + } + $module->setData($key, $value); + } if ($ssl) { $module->setData('fingerprint', Request::post('fingerprint', '')); } else { |