diff options
Diffstat (limited to 'modules/gallery')
-rw-r--r-- | modules/gallery/controllers/admin_identity.php | 19 | ||||
-rw-r--r-- | modules/gallery/helpers/identity.php | 34 | ||||
-rw-r--r-- | modules/gallery/helpers/module.php | 4 | ||||
-rw-r--r-- | modules/gallery/libraries/IdentityProvider.php | 26 | ||||
-rw-r--r-- | modules/gallery/libraries/drivers/IdentityProvider.php | 10 | ||||
-rw-r--r-- | modules/gallery/views/admin_identity.html.php | 4 | ||||
-rw-r--r-- | modules/gallery/views/admin_identity_confirm.html.php | 2 |
7 files changed, 38 insertions, 61 deletions
diff --git a/modules/gallery/controllers/admin_identity.php b/modules/gallery/controllers/admin_identity.php index d06132ff..0521a0f8 100644 --- a/modules/gallery/controllers/admin_identity.php +++ b/modules/gallery/controllers/admin_identity.php @@ -47,23 +47,26 @@ class Admin_Identity_Controller extends Admin_Controller { module::event("pre_identity_change", $active_provider, $new_provider); - identity::deactivate(); + module::deactivate($active_provider); + module::uninstall($active_provider); + + try { + Session::instance()->destroy(); + } catch (Exception $e) { + // We don't care if there was a problem destroying the session. + } // Switch authentication - module::set_var("gallery", "identity_provider", $new_provider); identity::reset(); + module::set_var("gallery", "identity_provider", $new_provider); - identity::activate(); + module::install($new_provider); + module::activate($new_provider); // @todo this type of collation is questionable from an i18n perspective message::success(t("Changed to %description", array("description" => $providers->$new_provider))); - try { - Session::instance()->destroy(); - } catch (Exception $e) { - // We don't care if there was a problem destroying the session. - } url::redirect(item::root()->abs_url()); } diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php index cf84c8a9..d0cba8e7 100644 --- a/modules/gallery/helpers/identity.php +++ b/modules/gallery/helpers/identity.php @@ -40,6 +40,16 @@ class identity_Core { } /** + * Frees the current instance of the identity provider so the next call to instance will reload + * + * @param string configuration + * @return Identity_Core + */ + static function reset() { + IdentityProvider::reset(); + } + + /** * Make sure that we have a session and group_ids cached in the session. */ static function load_user() { @@ -71,12 +81,12 @@ class identity_Core { $session->set("group_ids", $ids); } //} catch (Exception $e) { - //try { - //Session::instance()->destroy(); - //} catch (Exception $e) { + // try { + // Session::instance()->destroy(); + // } catch (Exception $e) { // We don't care if there was a problem destroying the session. - //} - //url::redirect(item::root()->abs_url()); + // } + // url::redirect(item::root()->abs_url()); //} } @@ -126,20 +136,6 @@ class identity_Core { } /** - * @see IdentityProvider_Driver::activate. - */ - static function activate() { - IdentityProvider::instance()->activate(); - } - - /** - * @see IdentityProvider_Driver::deactivate. - */ - static function deactivate() { - IdentityProvider::instance()->deactivate(); - } - - /** * @see IdentityProvider_Driver::guest. */ static function guest() { diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 1d77e63d..9d41cd51 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -130,6 +130,8 @@ class module_Core { array_unshift($kohana_modules, MODPATH . $module_name); Kohana::config_set("core.modules", $kohana_modules); + // Rebuild the include path so the module installer can benefit from auto loading + Kohana::include_paths(true); $installer_class = "{$module_name}_installer"; if (method_exists($installer_class, "install")) { call_user_func_array(array($installer_class, "install"), array()); @@ -154,7 +156,7 @@ class module_Core { */ static function upgrade($module_name) { $kohana_modules = Kohana::config("core.modules"); - array_unshift($kohana_modules, MODPATH . $module_name); + $kohana_modules = array_unshift($kohana_modules, MODPATH . $module_name); Kohana::config_set("core.modules", $kohana_modules); $version_before = module::get_version($module_name); diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 512f28eb..38718d4b 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -38,7 +38,7 @@ class IdentityProvider_Core { * @return Identity_Core */ static function & instance() { - if (!isset(self::$instance)) { + if (empty(self::$instance)) { // Create a new instance self::$instance = new IdentityProvider(); } @@ -47,14 +47,14 @@ class IdentityProvider_Core { } /** - * Returns a singleton instance of Identity. - * There can only be one Identity driver configured at a given point + * Frees the current instance of the identity provider so the next call to instance will reload * * @param string configuration * @return Identity_Core */ static function reset() { - self::$instance = new IdentityProvider(); + self::$instance = null; + Kohana::config_clear("identity"); } /** @@ -66,12 +66,12 @@ class IdentityProvider_Core { $config = module::get_var("gallery", "identity_provider", "user"); // Test the config group name - if (($this->config = Kohana::config("identity.".$config)) === NULL) { + if (($this->config = Kohana::config("identity." . $config)) === NULL) { throw new Exception("@todo NO USER LIBRARY CONFIGURATION FOR: $config"); } // Set driver name - $driver = "IdentityProvider_".ucfirst($this->config["driver"])."_Driver"; + $driver = "IdentityProvider_" . ucfirst($this->config["driver"]) ."_Driver"; // Load the driver if ( ! Kohana::auto_load($driver)) { @@ -101,20 +101,6 @@ class IdentityProvider_Core { } /** - * @see IdentityProvider_Driver::activate. - */ - public function activate() { - $this->driver->activate(); - } - - /** - * @see IdentityProvider_Driver::deactivate. - */ - public function deactivate() { - $this->driver->deactivate(); - } - - /** * @see IdentityProvider_Driver::guest. */ public function guest() { diff --git a/modules/gallery/libraries/drivers/IdentityProvider.php b/modules/gallery/libraries/drivers/IdentityProvider.php index 8a578d1b..5bb41dcc 100644 --- a/modules/gallery/libraries/drivers/IdentityProvider.php +++ b/modules/gallery/libraries/drivers/IdentityProvider.php @@ -19,16 +19,6 @@ */ interface IdentityProvider_Driver { /** - * Initialize the provider so it is ready to use - */ - public function activate(); - - /** - * Cleanup up this provider so it is unavailable for use and won't conflict with the current driver - */ - public function deactivate(); - - /** * Return the guest user. * * @return User_Definition the user object diff --git a/modules/gallery/views/admin_identity.html.php b/modules/gallery/views/admin_identity.html.php index 1405cacb..358860cf 100644 --- a/modules/gallery/views/admin_identity.html.php +++ b/modules/gallery/views/admin_identity.html.php @@ -10,7 +10,7 @@ $("#g-dialog").html(data); $("#g-dialog").dialog({ bgiframe: true, - title: "<?= t("Confirm Change Identity Provider") ?>", + title: <?= t("Confirm identity provider change")->for_js() ?>, resizable: false, height:165, modal: true, @@ -34,7 +34,7 @@ </script> <div id="g-modules"> - <h1> <?= t("Gallery Identity Management") ?> </h1> + <h1> <?= t("Manage Identity Providers") ?> </h1> <p> <?= t("Choose a different user/group management provider.") ?> </p> diff --git a/modules/gallery/views/admin_identity_confirm.html.php b/modules/gallery/views/admin_identity_confirm.html.php index e14525b5..54aae9c8 100644 --- a/modules/gallery/views/admin_identity_confirm.html.php +++ b/modules/gallery/views/admin_identity_confirm.html.php @@ -4,7 +4,7 @@ <?= form::hidden("provider", $new_provider) ?> <p><span class="ui-icon ui-icon-alert" style="float: left; margin:0 7px 20px 0;"></span> - <?= t("Do you really want to switch Identity providers? Continuing will delete all existing users.") ?> + <?= t("Are you sure you want to change your Identity Provider? Continuing will delete all existing users.") ?> </p> </form> |