diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-20 17:01:19 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-20 17:01:19 -0700 |
commit | 3ece1a01f25270939b3c12f754d555d6ac54d375 (patch) | |
tree | 2e802e5430b42ea1d5f64d13e5503f1a06d6bfcd /modules | |
parent | 7f9441c33da07b215efcb51668434b3957559fd3 (diff) |
Add a groups api method on the Identity provider and change access_Core::_get_all_groups() to use this to get the defined groups.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/helpers/access.php | 7 | ||||
-rw-r--r-- | modules/gallery/libraries/Identity.php | 11 | ||||
-rw-r--r-- | modules/gallery/libraries/drivers/Identity.php | 5 | ||||
-rw-r--r-- | modules/user/libraries/drivers/Identity/Gallery.php | 8 |
4 files changed, 26 insertions, 5 deletions
diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index fba161e3..4e7491e3 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -419,10 +419,11 @@ class access_Core { * @return ORM_Iterator */ private static function _get_all_groups() { - // When we build the gallery package, it's possible that the user module is not installed yet. + // When we build the gallery package, it's possible that there is no identity provider installed yet. // This is ok at packaging time, so work around it. - if (module::is_active("user")) { - return ORM::factory("group")->find_all(); + $config = module::get_var("gallery", "identity_provider"); + if (!empty($config)) { + return Identity::groups(); } else { return array(); } diff --git a/modules/gallery/libraries/Identity.php b/modules/gallery/libraries/Identity.php index 3fcb6756..3ef13a6d 100644 --- a/modules/gallery/libraries/Identity.php +++ b/modules/gallery/libraries/Identity.php @@ -65,11 +65,11 @@ class Identity_Core { * @return void */ public function __construct() { - $name = $config = module::get_var("gallery", "identity_provider", "user"); + $config = module::get_var("gallery", "identity_provider", "user"); // Test the config group name if (($this->config = Kohana::config("identity.".$config)) === NULL) { - throw new Exception("@todo NO USER LIBRARY CONFIGURATION FOR: $name"); + throw new Exception("@todo NO USER LIBRARY CONFIGURATION FOR: $config"); } // Set driver name @@ -205,4 +205,11 @@ class Identity_Core { static function get_user_list($ids) { return self::instance()->driver->get_user_list($ids); } + + /** + * @see Identity_Driver::groups. + */ + static function groups() { + return self::instance()->driver->groups(); + } } // End Identity diff --git a/modules/gallery/libraries/drivers/Identity.php b/modules/gallery/libraries/drivers/Identity.php index 2fc4d349..b77eb6be 100644 --- a/modules/gallery/libraries/drivers/Identity.php +++ b/modules/gallery/libraries/drivers/Identity.php @@ -97,6 +97,11 @@ interface Identity_Driver { */ public function get_user_list($ids); + /** + * List the groups defined in the Identity Provider + */ + static function groups(); + } // End Identity Driver Definition interface Group_Definition {} diff --git a/modules/user/libraries/drivers/Identity/Gallery.php b/modules/user/libraries/drivers/Identity/Gallery.php index f4b4d8a7..8e6e204d 100644 --- a/modules/user/libraries/drivers/Identity/Gallery.php +++ b/modules/user/libraries/drivers/Identity/Gallery.php @@ -131,5 +131,13 @@ class Identity_Gallery_Driver implements Identity_Driver { ->find_all() ->as_array(); } + + /** + * @see Identity_Driver::groups. + */ + static function groups() { + return ORM::factory("group")->find_all(); + } + } // End Identity Gallery Driver |