summaryrefslogtreecommitdiffstats
path: root/modules/sysconfig/addmodule_adauth.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-03-21 18:15:31 +0100
committerSimon Rettberg2016-03-21 18:15:31 +0100
commitea385dfb9f076a09e1c11eccc037d7cabccb7bcf (patch)
treeb3e382505200a7cb44594b4ad074ae5e7778a2fe /modules/sysconfig/addmodule_adauth.inc.php
parent[event.inc] Remove debug output (diff)
downloadslx-admin-ea385dfb9f076a09e1c11eccc037d7cabccb7bcf.tar.gz
slx-admin-ea385dfb9f076a09e1c11eccc037d7cabccb7bcf.tar.xz
slx-admin-ea385dfb9f076a09e1c11eccc037d7cabccb7bcf.zip
[adauth] Configurable home directory mount logic
Diffstat (limited to 'modules/sysconfig/addmodule_adauth.inc.php')
-rw-r--r--modules/sysconfig/addmodule_adauth.inc.php96
1 files changed, 82 insertions, 14 deletions
diff --git a/modules/sysconfig/addmodule_adauth.inc.php b/modules/sysconfig/addmodule_adauth.inc.php
index ed8a17ea..cba09382 100644
--- a/modules/sysconfig/addmodule_adauth.inc.php
+++ b/modules/sysconfig/addmodule_adauth.inc.php
@@ -303,23 +303,24 @@ class AdAuth_CheckCredentials extends AddModule_Base
'certificate' => Request::post('certificate', ''),
'originalbinddn' => Request::post('originalbinddn'),
'prev' => 'AdAuth_Start',
- 'next' => 'AdAuth_Finish'
+ 'next' => 'AdAuth_HomeDir'
))
);
}
}
-class AdAuth_Finish extends AddModule_Base
+class AdAuth_HomeDir extends AddModule_Base
{
- private $taskIds;
-
+ private $searchbase;
+ private $binddn;
+
protected function preprocessInternal()
{
- $binddn = Request::post('binddn');
- $searchbase = Request::post('searchbase');
- if (empty($searchbase)) {
+ $this->binddn = Request::post('binddn');
+ $this->searchbase = Request::post('searchbase');
+ if (empty($this->searchbase)) {
// If no search base was given, determine it from the dn
$originalBindDn = str_replace('\\', '/', trim(Request::post('originalbinddn')));
if (!preg_match('#^([^/]+)/[^/]+$#', $originalBindDn, $out)) {
@@ -327,25 +328,81 @@ class AdAuth_Finish 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($binddn, '=' . $out[1] . ',');
+ $i = mb_stripos($this->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($binddn, 0, $i), ',');
+ $i = mb_strrpos(mb_substr($this->binddn, 0, $i), ',');
if ($i === false)
$i = -1;
- $searchbase = mb_substr($binddn, $i + 1);
+ $this->searchbase = mb_substr($this->binddn, $i + 1);
} else {
$somedn = Request::post('somedn', false);
if (!empty($somedn)) {
- $i = stripos($somedn, $searchbase);
+ $i = stripos($somedn, $this->searchbase);
if ($i !== false) {
- $searchbase = substr($somedn, $i, strlen($searchbase));
+ $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"';
}
}
+ $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');
@@ -355,13 +412,24 @@ class AdAuth_Finish extends AddModule_Base
$module = $this->edit;
$ssl = Request::post('ssl', 'off') === 'on';
$module->setData('server', Request::post('server'));
- $module->setData('searchbase', $searchbase);
- $module->setData('binddn', $binddn);
+ $module->setData('searchbase', Request::post('searchbase'));
+ $module->setData('binddn', Request::post('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 {