summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/identity.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/identity.php')
-rw-r--r--modules/gallery/helpers/identity.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php
index 4febc4e2..5de05948 100644
--- a/modules/gallery/helpers/identity.php
+++ b/modules/gallery/helpers/identity.php
@@ -72,12 +72,14 @@ class identity_Core {
auth::login(IdentityProvider::instance()->admin_user());
}
- if (!$session->get("group_ids")) {
+ // Cache the group ids for a day to trade off performance for security updates.
+ if (!$session->get("group_ids") || $session->get("group_ids_timeout", 0) < time()) {
$ids = array();
foreach ($user->groups() as $group) {
$ids[] = $group->id;
}
$session->set("group_ids", $ids);
+ $session->set("group_ids_timeout", time() + 86400);
}
} catch (Exception $e) {
// Log it, so we at least have so notification that we swallowed the exception.