diff options
Diffstat (limited to 'modules-available/sysconfig/addmodule_ldapauth.inc.php')
-rw-r--r-- | modules-available/sysconfig/addmodule_ldapauth.inc.php | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/modules-available/sysconfig/addmodule_ldapauth.inc.php b/modules-available/sysconfig/addmodule_ldapauth.inc.php index 6d612e9e..6a385d9c 100644 --- a/modules-available/sysconfig/addmodule_ldapauth.inc.php +++ b/modules-available/sysconfig/addmodule_ldapauth.inc.php @@ -9,15 +9,14 @@ class LdapAuth_Start extends AddModule_Base protected function renderInternal() { - $LDAPAUTH_COMMON_FIELDS = array('title', 'server', 'searchbase', 'binddn', 'bindpw', 'home', 'homeattr', 'ssl', 'fixnumeric', 'genuid', 'certificate', 'mapping', 'nohomewarn'); + $LDAPAUTH_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, $LDAPAUTH_COMMON_FIELDS); $data['title'] = $this->edit->title(); $data['edit'] = $this->edit->id(); - } - if (!isset($data['fixnumeric']) || $data['fixnumeric'] === false) { - $data['fixnumeric'] = 's'; + } else { + $data['ssl'] = true; } postToArray($data, $LDAPAUTH_COMMON_FIELDS, true); if (isset($data['server']) && preg_match('/^(.*)\:(636|389)$/', $data['server'], $out)) { @@ -28,7 +27,7 @@ class LdapAuth_Start extends AddModule_Base } $data['step'] = 'LdapAuth_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', 'ldapAuth_title'), false, 'ldap-start', $data); } @@ -65,7 +64,6 @@ class LdapAuth_CheckConnection extends AddModule_Base )); if (!isset($this->scanTask['id'])) { AddModule_Base::setStep('LdapAuth_Start'); // Continues with LdapAuth_Start for render() - return; } } @@ -80,11 +78,10 @@ class LdapAuth_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'], - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), ); $data['prev'] = 'LdapAuth_Start'; $data['next'] = 'LdapAuth_CheckCredentials'; @@ -152,11 +149,10 @@ class LdapAuth_CheckCredentials 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', ''), - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), 'prev' => 'LdapAuth_Start', 'next' => 'LdapAuth_HomeDir', )) @@ -193,16 +189,15 @@ class LdapAuth_HomeDir 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'), - 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')), + 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', null, 'array')), 'prev' => 'LdapAuth_Start', 'next' => 'LdapAuth_Finish', ); - if ($this->edit !== false) { + if ($this->edit !== null) { foreach (self::getAttributes() as $key) { if ($this->edit->getData($key)) { $data[$key . '_c'] = 'checked="checked"'; @@ -223,13 +218,13 @@ class LdapAuth_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', 'ldapAuth_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'); @@ -247,12 +242,13 @@ class LdapAuth_Finish extends AddModule_Base $title = Request::post('title'); if (empty($title)) $title = 'LDAP: ' . Request::post('server'); - if ($this->edit === false) + if ($this->edit === null) { $module = ConfigModule::getInstance('LdapAuth'); - else + } else { $module = $this->edit; + } $ssl = Request::post('ssl', 'off') === 'on'; - foreach (['searchbase', 'binddn', 'server', 'bindpw', 'home', 'nohomewarn', 'certificate', 'fixnumeric', 'genuid', + foreach (['searchbase', 'binddn', 'server', 'bindpw', 'home', 'nohomewarn', 'certificate', 'genuid', 'ldapAttrMountOpts', 'shareHomeMountOpts'] as $key) { $module->setData($key, Request::post($key, '', 'string')); } @@ -274,15 +270,16 @@ class LdapAuth_Finish extends AddModule_Base } else { $module->setData('fingerprint', ''); } - if ($this->edit !== false) + if ($this->edit !== null) { $ret = $module->update($title); - else + } else { $ret = $module->insert($title); + } if (!$ret) { 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('LdapAuth_Start'); // Continues with LdapAuth_Start for render() @@ -291,6 +288,10 @@ class LdapAuth_Finish extends AddModule_Base $this->taskIds = array( 'tm-config' => $tgz, ); + + if ($this->edit === null) { + AddModule_Base::setStep('AddModule_Assign', $module->id()); + } } protected function renderInternal() |