summaryrefslogtreecommitdiff
path: root/modules/user/libraries
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-06 07:55:31 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-06 07:55:31 -0700
commit6e59de2fb5b379a7a839e27c92f7546ee568cf00 (patch)
tree53c5df80660eff087799a036801ba7c418684d99 /modules/user/libraries
parent8285cd58e27dfdc2f013f44c1e69aa82f87b7c83 (diff)
Change the notification handler to use the Identity API to lookup subscribers
for event notifications. This drove out some issues in the user::users and group::groups API backend.
Diffstat (limited to 'modules/user/libraries')
-rw-r--r--modules/user/libraries/drivers/Identity/Gallery.php36
1 files changed, 24 insertions, 12 deletions
diff --git a/modules/user/libraries/drivers/Identity/Gallery.php b/modules/user/libraries/drivers/Identity/Gallery.php
index 774ef77c..5e201cb7 100644
--- a/modules/user/libraries/drivers/Identity/Gallery.php
+++ b/modules/user/libraries/drivers/Identity/Gallery.php
@@ -211,12 +211,7 @@ class Identity_Gallery_Driver implements Identity_Driver {
* @return array the group list.
*/
public function list_users($filter=array()) {
- $user = ORM::factory("user");
- foreach($filter as $method => $args) {
- $user->$method($args);
- }
-
- return $user->find_all();
+ return $this->_do_search("user", $filter);
}
@@ -226,12 +221,7 @@ class Identity_Gallery_Driver implements Identity_Driver {
* @return array the group list.
*/
public function list_groups($filter=array()) {
- $user = ORM::factory("group");
- foreach($filter as $method => $args) {
- $user->$method($args);
- }
-
- return $user->find_all();
+ return $this->_do_search("group", $filter);
}
/**
@@ -243,4 +233,26 @@ class Identity_Gallery_Driver implements Identity_Driver {
public function get_edit_rules($object_type) {
return (object)ORM::factory($object_type)->rules;
}
+
+ /**
+ * Build the query based on the supplied filters for the specified model.
+ * @param string $object_type to return rules for ("user"|"group")
+ * @param mixed $filters options to apply to the selection.
+ */
+ private function _do_search($object_type, $filter) {
+ $object = ORM::factory($object_type);
+
+ foreach ($filter as $method => $args) {
+ switch ($method) {
+ case "in":
+ $object->in($args[0], $args[1]);
+ break;
+ default:
+ $object->$method($args);
+ }
+ }
+
+ return $object->find_all();
+ }
+
} // End Identity Gallery Driver \ No newline at end of file