diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-02-14 13:57:50 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-02-14 13:57:50 +0100 |
commit | 741b8a48682890ee68e3f650510fec9a4d47d5b0 (patch) | |
tree | 54c03dcbf2944dbc1f49fc3f2f063751f1ad2aa7 /lib/plugins/authad/auth.php | |
parent | 4f1a1db1539e819e5c40ec14453c4c709810e1bd (diff) | |
download | rpg-741b8a48682890ee68e3f650510fec9a4d47d5b0.tar.gz rpg-741b8a48682890ee68e3f650510fec9a4d47d5b0.tar.bz2 |
Show a domain dropdown when multiple AD domains are configured
This integrates the functionality of the now outdated addomain plugin
directly into the authad plugin and makes multi-domain setups usable
without SSO.
See also https://github.com/cosmocode/dokuwiki-plugin-addomain
Diffstat (limited to 'lib/plugins/authad/auth.php')
-rw-r--r-- | lib/plugins/authad/auth.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index e1d758fb8..db9b179a6 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -512,6 +512,31 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { } /** + * Returns a list of configured domains + * + * The default domain has an empty string as key + * + * @return array associative array(key => domain) + */ + public function _getConfiguredDomains() { + $domains = array(); + if(empty($this->conf['account_suffix'])) return $domains; // not configured yet + + // add default domain, using the name from account suffix + $domains[''] = ltrim($this->conf['account_suffix'], '@'); + + // find additional domains + foreach($this->conf as $key => $val) { + if(is_array($val) && isset($val['account_suffix'])) { + $domains[$key] = ltrim($val['account_suffix'], '@'); + } + } + ksort($domains); + + return $domains; + } + + /** * Check provided user and userinfo for matching patterns * * The patterns are set up with $this->_constructPattern() |