From 3bddad0ec251a75e6554e8a9b986ff7e2b234ec7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 12 Sep 2015 17:58:08 +0200 Subject: [ldap] new module --- inc/configmodule/adauth.inc.php | 2 +- inc/configmodule/ldapauth.inc.php | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 inc/configmodule/ldapauth.inc.php (limited to 'inc') diff --git a/inc/configmodule/adauth.inc.php b/inc/configmodule/adauth.inc.php index 64937aa8..f1da4d76 100644 --- a/inc/configmodule/adauth.inc.php +++ b/inc/configmodule/adauth.inc.php @@ -30,7 +30,7 @@ class ConfigModule_AdAuth extends ConfigModule $config['proxyport'] = 3100 + $this->id(); $config['filename'] = $tgz; $config['moduleid'] = $this->id(); - return Taskmanager::submit('CreateAdConfig', $config); + return Taskmanager::submit('CreateLdapConfig', $config); } protected function moduleVersion() diff --git a/inc/configmodule/ldapauth.inc.php b/inc/configmodule/ldapauth.inc.php new file mode 100644 index 00000000..c5a432e9 --- /dev/null +++ b/inc/configmodule/ldapauth.inc.php @@ -0,0 +1,67 @@ +id(), $parent); + $config = $this->moduleData; + if (preg_match('/^([^\:]+)\:(\d+)$/', $config['server'], $out)) { + $config['server'] = $out[1]; + $config['ldapport'] = $out[2]; + } + $config['parentTask'] = $parent; + $config['failOnParentFail'] = false; + $config['proxyip'] = Property::getServerIp(); + $config['proxyport'] = 3100 + $this->id(); + $config['filename'] = $tgz; + $config['moduleid'] = $this->id(); + $config['plainldap'] = true; + return Taskmanager::submit('CreateLdapConfig', $config); + } + + protected function moduleVersion() + { + return self::VERSION; + } + + protected function validateConfig() + { + // Check if required fields are filled + return Util::hasAllKeys($this->moduleData, self::$REQUIRED_FIELDS); + } + + public function setData($key, $value) + { + if (!in_array($key, self::$REQUIRED_FIELDS) && !in_array($key, self::$OPTIONAL_FIELDS)) + return false; + $this->moduleData[$key] = $value; + return true; + } + + // ############## Callbacks ############################# + + /** + * Server IP changed - rebuild all LDAP modules. + */ + public function event_serverIpChanged() + { + error_log('Calling generate on ' . $this->title()); + $this->generate(false); + } + +} -- cgit v1.2.3-55-g7522