From b8bce53b8f19e869762e9405693bad5aa377a5f4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 22 Jan 2010 09:42:41 -0800 Subject: [PATCH] Use the admin module to install and switch to the LDAP identity provider. --- modules/ldap/helpers/ldap_installer.php | 19 ++++++++++++++++++- modules/ldap/module.info | 3 --- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/ldap/helpers/ldap_installer.php b/modules/ldap/helpers/ldap_installer.php index c68ac6b6..f8180eba 100644 --- a/modules/ldap/helpers/ldap_installer.php +++ b/modules/ldap/helpers/ldap_installer.php @@ -18,15 +18,32 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class ldap_installer { + static function check_environment() { + return array(); + } + static function install() { + $current_provider = module::get_var("gallery", "identity_provider"); + if (!empty($current_provider)) { + module::uninstall($current_provider); + } + + IdentityProvider::reset(); + module::set_var("gallery", "identity_provider", "ldap"); + module::set_version("ldap", 1); $root = item::root(); - $ldap_provider = new IdentityProvider("ldap"); + $ldap_provider = IdentityProvider::instance(); foreach ($ldap_provider->groups() as $group) { module::event("group_created", $group); access::allow($group, "view", $root); access::allow($group, "view_full", $root); } + + module::event("identity_provider_changed", $current_provider, "ldap"); + + auth::login($ldap_provider->admin_user()); + Session::instance()->regenerate(); } static function uninstall() { diff --git a/modules/ldap/module.info b/modules/ldap/module.info index 1b7bef08..06fa311b 100644 --- a/modules/ldap/module.info +++ b/modules/ldap/module.info @@ -1,6 +1,3 @@ name = "LDAP" description = "Use LDAP for authentication" version = 1 - -; Don't show this module on the module administration screen -no_module_admin = 1