summaryrefslogtreecommitdiffstats
path: root/modules/sysconfig/addmodule_adauth.inc.php
diff options
context:
space:
mode:
authorJonathan Bauer2016-04-01 16:50:13 +0200
committerJonathan Bauer2016-04-01 16:50:13 +0200
commitdbc0d9614421e064cc62aacf116ebb783c83f2f3 (patch)
tree091844b8578ff1d9ac18edfd3cee3e63210133d7 /modules/sysconfig/addmodule_adauth.inc.php
parent[ldapauth] Add homedir conf to ldap wizard (diff)
downloadslx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.gz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.xz
slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.zip
[merge] merging c3sl / fr - initial commit
Diffstat (limited to 'modules/sysconfig/addmodule_adauth.inc.php')
-rw-r--r--modules/sysconfig/addmodule_adauth.inc.php108
1 files changed, 20 insertions, 88 deletions
diff --git a/modules/sysconfig/addmodule_adauth.inc.php b/modules/sysconfig/addmodule_adauth.inc.php
index cba09382..e295630c 100644
--- a/modules/sysconfig/addmodule_adauth.inc.php
+++ b/modules/sysconfig/addmodule_adauth.inc.php
@@ -25,7 +25,7 @@ class AdAuth_Start extends AddModule_Base
$data['server'] = $out[1];
}
$data['step'] = 'AdAuth_CheckConnection';
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad-start', $data);
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad-start', $data);
}
}
@@ -88,7 +88,7 @@ class AdAuth_CheckConnection extends AddModule_Base
} else {
$data['next'] = 'AdAuth_CheckCredentials';
}
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad_ldap-checkconnection', $data);
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad_ldap-checkconnection', $data);
}
}
@@ -165,7 +165,7 @@ class AdAuth_SelfSearch extends AddModule_Base
} else {
$data['next'] = 'AdAuth_CheckCredentials';
}
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad-selfsearch',
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad-selfsearch',
array_merge($this->taskIds, $data));
}
@@ -218,7 +218,7 @@ class AdAuth_HomeAttrCheck extends AddModule_Base
protected function renderInternal()
{
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad-selfsearch', array_merge($this->taskIds, array(
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad-selfsearch', array_merge($this->taskIds, array(
'edit' => Request::post('edit'),
'title' => Request::post('title'),
'server' => Request::post('server'),
@@ -289,7 +289,7 @@ class AdAuth_CheckCredentials extends AddModule_Base
protected function renderInternal()
{
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad_ldap-checkcredentials', array_merge($this->taskIds, array(
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad_ldap-checkcredentials', array_merge($this->taskIds, array(
'edit' => Request::post('edit'),
'title' => Request::post('title'),
'server' => Request::post('server') . ':' . Request::post('port'),
@@ -303,24 +303,23 @@ class AdAuth_CheckCredentials extends AddModule_Base
'certificate' => Request::post('certificate', ''),
'originalbinddn' => Request::post('originalbinddn'),
'prev' => 'AdAuth_Start',
- 'next' => 'AdAuth_HomeDir'
+ 'next' => 'AdAuth_Finish'
))
);
}
}
-class AdAuth_HomeDir extends AddModule_Base
+class AdAuth_Finish extends AddModule_Base
{
- private $searchbase;
- private $binddn;
-
+ private $taskIds;
+
protected function preprocessInternal()
{
- $this->binddn = Request::post('binddn');
- $this->searchbase = Request::post('searchbase');
- if (empty($this->searchbase)) {
+ $binddn = Request::post('binddn');
+ $searchbase = Request::post('searchbase');
+ if (empty($searchbase)) {
// If no search base was given, determine it from the dn
$originalBindDn = str_replace('\\', '/', trim(Request::post('originalbinddn')));
if (!preg_match('#^([^/]+)/[^/]+$#', $originalBindDn, $out)) {
@@ -328,81 +327,25 @@ class AdAuth_HomeDir extends AddModule_Base
Util::redirect('?do=SysConfig&action=addmodule&step=AdAuth_Start');
} // $out[1] is the domain
// Find the domain in the dn
- $i = mb_stripos($this->binddn, '=' . $out[1] . ',');
+ $i = mb_stripos($binddn, '=' . $out[1] . ',');
if ($i === false) {
Message::addError('value-invalid', 'binddn', $out[1]);
Util::redirect('?do=SysConfig&action=addmodule&step=AdAuth_Start');
}
// Now find ',' before it so we get the key
- $i = mb_strrpos(mb_substr($this->binddn, 0, $i), ',');
+ $i = mb_strrpos(mb_substr($binddn, 0, $i), ',');
if ($i === false)
$i = -1;
- $this->searchbase = mb_substr($this->binddn, $i + 1);
+ $searchbase = mb_substr($binddn, $i + 1);
} else {
$somedn = Request::post('somedn', false);
if (!empty($somedn)) {
- $i = stripos($somedn, $this->searchbase);
+ $i = stripos($somedn, $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' => $this->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' => 'AdAuth_Start',
- 'next' => 'AdAuth_Finish'
- );
- if ($this->edit !== false) {
- foreach (self::getAttributes() as $key) {
- if ($this->edit->getData($key)) {
- $data[$key . '_c'] = 'checked="checked"';
+ $searchbase = substr($somedn, $i, strlen($searchbase));
}
}
- $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', 'adAuth_title'), false, 'sysconfig/ad_ldap-homedir', $data);
- }
-
- public static function getAttributes()
- {
- return array('shareRemapMode', 'shareRemapCreate', 'shareDocuments', 'shareDownloads', 'shareDesktop', 'shareMedia', 'shareOther', 'shareHomeDrive');
- }
-
-}
-
-class AdAuth_Finish extends AddModule_Base
-{
-
- private $taskIds;
-
- protected function preprocessInternal()
- {
$title = Request::post('title');
if (empty($title))
$title = 'AD: ' . Request::post('server');
@@ -412,24 +355,13 @@ class AdAuth_Finish extends AddModule_Base
$module = $this->edit;
$ssl = Request::post('ssl', 'off') === 'on';
$module->setData('server', Request::post('server'));
- $module->setData('searchbase', Request::post('searchbase'));
- $module->setData('binddn', Request::post('binddn'));
+ $module->setData('searchbase', $searchbase);
+ $module->setData('binddn', $binddn);
$module->setData('bindpw', Request::post('bindpw'));
$module->setData('home', Request::post('home'));
$module->setData('homeattr', Request::post('homeattr'));
$module->setData('certificate', Request::post('certificate'));
$module->setData('ssl', $ssl);
- foreach (AdAuth_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 {
@@ -475,7 +407,7 @@ class AdAuth_Finish extends AddModule_Base
protected function renderInternal()
{
- Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'sysconfig/ad-finish', $this->taskIds);
+ Render::addDialog(Dictionary::translate('config-module', 'adAuth_title'), false, 'ad-finish', $this->taskIds);
}
}