summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-17 17:40:45 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-17 17:40:45 +0000
commit130e26983aedac1e4bb9f26d6a82c629248075e8 (patch)
treedb8d5b860a3a81649f8576f1fb16cde1c08725f0 /core
parent2abe82f106ecf68d40df5dee40876edd06ff5f60 (diff)
Add initialization to the user module to put the user and group_ids
into the session, for easy access. This cuts down the number of queries when we're loading images through file_proxy.php
Diffstat (limited to 'core')
-rw-r--r--core/helpers/access.php4
-rw-r--r--core/helpers/module.php6
2 files changed, 6 insertions, 4 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php
index 05799bf5..82d7b9b6 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -98,8 +98,8 @@ class access_Core {
$resource = $perm_name == "view" ?
$item : model_cache::get("access_cache", $item->id, "item_id");
- foreach (user::active()->groups as $group) {
- if ($resource->__get("{$perm_name}_{$group->id}") === self::ALLOW) {
+ foreach (user::group_ids() as $id) {
+ if ($resource->__get("{$perm_name}_$id") === self::ALLOW) {
return true;
}
}
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 02851528..5713901d 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -117,6 +117,8 @@ class module_Core {
//
// @todo get rid of this extra error checking when we have an installer.
set_error_handler(array("module", "_dummy_error_handler"));
+ $modules = ORM::factory("module")->find_all();
+ restore_error_handler();
// Reload module list from the config file since we'll do a refresh after calling install()
$core = Kohana::config_load('core');
@@ -124,7 +126,7 @@ class module_Core {
self::$module_names = array();
self::$modules = array();
try {
- foreach (ORM::factory("module")->find_all() as $module) {
+ foreach ($modules as $module) {
self::$module_names[] = $module->name;
self::$modules[] = $module;
$kohana_modules[] = MODPATH . $module->name;
@@ -136,7 +138,7 @@ class module_Core {
self::$modules = array();
}
- restore_error_handler();
+ self::event("gallery_ready");
}
public function get_var($module_name, $name, $default_value=null) {