diff options
Diffstat (limited to 'modules-available/sysconfig/addmodule_adauth.inc.php')
-rw-r--r-- | modules-available/sysconfig/addmodule_adauth.inc.php | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/modules-available/sysconfig/addmodule_adauth.inc.php b/modules-available/sysconfig/addmodule_adauth.inc.php index 80b7cff1..42187171 100644 --- a/modules-available/sysconfig/addmodule_adauth.inc.php +++ b/modules-available/sysconfig/addmodule_adauth.inc.php @@ -13,15 +13,14 @@ class AdAuth_Start extends AddModule_Base protected function renderInternal() { - $ADAUTH_COMMON_FIELDS = array('title', 'server', 'searchbase', 'binddn', 'bindpw', 'home', 'homeattr', 'ssl', 'fixnumeric', 'genuid', 'certificate', 'mapping', 'nohomewarn'); + $ADAUTH_COMMON_FIELDS = array('title', 'server', 'searchbase', 'binddn', 'bindpw', 'home', 'homeattr', 'ssl', 'genuid', 'certificate', 'mapping', 'nohomewarn'); $data = array(); - if ($this->edit !== false) { + if ($this->edit !== null) { moduleToArray($this->edit, $data, $ADAUTH_COMMON_FIELDS); $data['title'] = $this->edit->title(); $data['edit'] = $this->edit->id(); - } - if ($data['fixnumeric'] === false) { - $data['fixnumeric'] = 's'; + } else { + $data['ssl'] = true; } postToArray($data, $ADAUTH_COMMON_FIELDS, true); $obdn = Request::post('originalbinddn'); @@ -36,7 +35,7 @@ class AdAuth_Start extends AddModule_Base } $data['step'] = 'AdAuth_CheckConnection'; $data['map_empty'] = true; - $data['mapping'] = ConfigModuleBaseLdap::getMapping(isset($data['mapping']) ? $data['mapping'] : false, $data['map_empty']); + $data['mapping'] = ConfigModuleBaseLdap::getMapping($data['mapping'] ?? null, $data['map_empty']); Render::addDialog(Dictionary::translateFile('config-module', 'adAuth_title'), false, 'ad-start', $data); } @@ -90,13 +89,12 @@ class AdAuth_CheckConnection extends AddModule_Base )); if (!isset($this->scanTask['id'])) { AddModule_Base::setStep('AdAuth_Start'); // Continues with AdAuth_Start for render() - return; } } protected function renderInternal() { - $mapping = Request::post('mapping', false, 'array'); + $mapping = Request::post('mapping', null, 'array'); $data = array( 'edit' => Request::post('edit'), 'title' => Request::post('title'), @@ -106,7 +104,6 @@ class AdAuth_CheckConnection extends AddModule_Base 'bindpw' => Request::post('bindpw'), 'home' => Request::post('home'), 'ssl' => Request::post('ssl'), - 'fixnumeric' => Request::post('fixnumeric'), 'genuid' => Request::post('genuid'), 'certificate' => Request::post('certificate', ''), 'taskid' => $this->scanTask['id'], @@ -133,7 +130,7 @@ class AdAuth_SelfSearch extends AddModule_Base protected function preprocessInternal() { - $server = $binddn = $port = null; + $server = $binddn = null; $searchbase = Request::post('searchbase', ''); $bindpw = Request::post('bindpw'); $ssl = Request::post('ssl', 'off') === 'on'; @@ -142,14 +139,8 @@ class AdAuth_SelfSearch extends AddModule_Base AddModule_Base::setStep('AdAuth_Start'); // Continues with AdAuth_Start for render() return; } - foreach (['server', 'binddn', 'port'] as $var) { - $$var = Request::post($var, null); - if (empty($$var)) { - Message::addError('main.parameter-empty', $var); - AddModule_Base::setStep('AdAuth_Start'); // Continues with AdAuth_Start for render() - return; - } - } + $server = Request::post('server', Request::REQUIRED, 'string'); + $binddn = Request::post('binddn', Request::REQUIRED, 'string'); $this->originalBindDn = ''; // Fix bindDN if short name given // @@ -197,7 +188,7 @@ class AdAuth_SelfSearch extends AddModule_Base protected function renderInternal() { - $mapping = Request::post('mapping', false, 'array'); + $mapping = Request::post('mapping', null, 'array'); $data = array( 'edit' => Request::post('edit'), 'title' => Request::post('title'), @@ -208,7 +199,6 @@ class AdAuth_SelfSearch extends AddModule_Base 'bindpw' => Request::post('bindpw'), 'home' => Request::post('home'), 'ssl' => Request::post('ssl') === 'on', - 'fixnumeric' => Request::post('fixnumeric'), 'genuid' => Request::post('genuid'), 'fingerprint' => Request::post('fingerprint'), 'certificate' => Request::post('certificate', ''), @@ -286,13 +276,12 @@ class AdAuth_HomeAttrCheck extends AddModule_Base 'bindpw' => Request::post('bindpw'), 'home' => Request::post('home'), 'ssl' => Request::post('ssl') === 'on', - 'fixnumeric' => Request::post('fixnumeric'), 'genuid' => Request::post('genuid'), 'fingerprint' => Request::post('fingerprint'), 'certificate' => Request::post('certificate', ''), 'originalbinddn' => Request::post('originalbinddn'), 'tryHomeAttr' => true, - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), 'prev' => 'AdAuth_Start', 'next' => 'AdAuth_CheckCredentials' )) @@ -359,12 +348,11 @@ class AdAuth_CheckCredentials extends AddModule_Base 'home' => Request::post('home'), 'homeattr' => Request::post('homeattr'), 'ssl' => Request::post('ssl') === 'on', - 'fixnumeric' => Request::post('fixnumeric'), 'genuid' => Request::post('genuid'), 'fingerprint' => Request::post('fingerprint'), 'certificate' => Request::post('certificate', ''), 'originalbinddn' => Request::post('originalbinddn'), - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), 'prev' => 'AdAuth_Start', 'next' => 'AdAuth_HomeDir' )) @@ -424,16 +412,15 @@ class AdAuth_HomeDir extends AddModule_Base 'home' => Request::post('home'), 'homeattr' => Request::post('homeattr'), 'ssl' => Request::post('ssl') === 'on', - 'fixnumeric' => Request::post('fixnumeric'), 'genuid' => Request::post('genuid'), 'fingerprint' => Request::post('fingerprint'), 'certificate' => Request::post('certificate', ''), 'originalbinddn' => Request::post('originalbinddn'), - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), 'prev' => 'AdAuth_Start', 'next' => 'AdAuth_Finish' ); - if ($this->edit !== false) { + if ($this->edit !== null) { foreach (self::getAttributes() as $key) { if ($this->edit->getData($key)) { $data[$key . '_c'] = 'checked="checked"'; @@ -454,13 +441,13 @@ class AdAuth_HomeDir extends AddModule_Base foreach (range('D', 'Z') as $l) { $data['drives'][] = array( 'drive' => $l . ':', - 'selected' => (strtoupper($letter{0}) === $l) ? 'selected="selected"' : '' + 'selected' => (strtoupper($letter[0]) === $l) ? 'selected="selected"' : '' ); } Render::addDialog(Dictionary::translateFile('config-module', 'adAuth_title'), false, 'ad_ldap-homedir', $data); } - public static function getAttributes() + public static function getAttributes(): array { return array('shareRemapMode', 'shareRemapCreate', 'shareDocuments', 'shareDownloads', 'shareDesktop', 'shareMedia', 'shareOther', 'shareHomeDrive', 'shareDomain', 'credentialPassthrough'); @@ -478,12 +465,13 @@ class AdAuth_Finish extends AddModule_Base $title = Request::post('title'); if (empty($title)) $title = 'AD: ' . Request::post('server'); - if ($this->edit === false) + if ($this->edit === null) { $module = ConfigModule::getInstance('AdAuth'); - else + } else { $module = $this->edit; + } $ssl = Request::post('ssl', 'off') === 'on'; - foreach (['searchbase', 'binddn', 'server', 'bindpw', 'home', 'nohomewarn', 'homeattr', 'certificate', 'fixnumeric', 'genuid', + foreach (['searchbase', 'binddn', 'server', 'bindpw', 'home', 'nohomewarn', 'homeattr', 'certificate', 'genuid', 'ldapAttrMountOpts', 'shareHomeMountOpts'] as $key) { $module->setData($key, Request::post($key, '', 'string')); } @@ -505,7 +493,7 @@ class AdAuth_Finish extends AddModule_Base } else { $module->setData('fingerprint', ''); } - if ($this->edit !== false) + if ($this->edit !== null) $ret = $module->update($title); else $ret = $module->insert($title); @@ -513,7 +501,7 @@ class AdAuth_Finish extends AddModule_Base Message::addError('main.value-invalid', 'any', 'any'); $tgz = false; } else { - $tgz = $module->generate($this->edit === false); + $tgz = $module->generate($this->edit === null); } if ($tgz === false) { AddModule_Base::setStep('AdAuth_Start'); // Continues with AdAuth_Start for render() @@ -522,6 +510,11 @@ class AdAuth_Finish extends AddModule_Base $this->taskIds = array( 'tm-config' => $tgz, ); + + if ($this->edit === null) { + AddModule_Base::setStep('AddModule_Assign', $module->id()); + } + } protected function renderInternal() |