diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-22 09:39:29 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-22 09:39:29 -0800 |
commit | 603c3049a1ce7249c55ff8338fc3ea69323f0cb3 (patch) | |
tree | 66fe177dbd83a1bce625bd1c8b12bc4feded3d1f /modules/user | |
parent | 0da5d9e606fba5b6dc6137812df32cd1d0f5750f (diff) |
Treat identity providers just like other modules and use the admin_module to
install and switch to a different identity provider.
Diffstat (limited to 'modules/user')
-rw-r--r-- | modules/user/helpers/user_installer.php | 24 | ||||
-rw-r--r-- | modules/user/module.info | 2 |
2 files changed, 11 insertions, 15 deletions
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 0cba502f..dd21c93c 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -20,6 +20,13 @@ class user_installer { static function install() { $db = Database::instance(); + $current_provider = module::get_var("gallery", "identity_provider"); + if (!empty($current_provider)) { + module::uninstall($current_provider); + } + IdentityProvider::reset(); + module::set_var("gallery", "identity_provider", "user"); + $db->query("CREATE TABLE IF NOT EXISTS {users} ( `id` int(9) NOT NULL auto_increment, `name` varchar(32) NOT NULL, @@ -70,19 +77,6 @@ class user_installer { $admin->admin = true; $admin->save(); - $current_provider = module::get_var("gallery", "identity_provider"); - if (empty($current_provider)) { - // If there is no provider defined then we are doing an initial install - // so we need to set the provider and make the administrator own everything - // If the installer is called and there is an identity provider, then we - // are switching identity providers and and the event handlers will do the - // right things - module::set_var("gallery", "identity_provider", "user"); - - // Let the admin own everything - $db->query("update {items} set owner_id = {$admin->id}"); - } - $root = ORM::factory("item", 1); access::allow($everybody, "view", $root); access::allow($everybody, "view_full", $root); @@ -93,6 +87,10 @@ class user_installer { module::set_var("user", "mininum_password_length", 5); module::set_version("user", 2); + module::event("identity_provider_changed", $current_provider, "user"); + + auth::login(IdentityProvider::instance()->admin_user()); + Session::instance()->regenerate(); } static function upgrade($version) { diff --git a/modules/user/module.info b/modules/user/module.info index 7178f108..d1e02382 100644 --- a/modules/user/module.info +++ b/modules/user/module.info @@ -2,5 +2,3 @@ name = "Users and Groups" description = "Gallery 3 user and group management" version = 2 -; Don't show this module on the module administration screen -no_module_admin = 1 |