diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2010-08-08 17:29:29 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-08-08 17:29:29 -0700 |
| commit | 58bf479f4c040ac73ea190d966ffd5408f9908f0 (patch) | |
| tree | a19dece598404b48cca783f89877944fd4538fb1 /modules/gallery/helpers/identity.php | |
| parent | 1ad1f9517f91875875f2e062bda7d834827c3430 (diff) | |
| parent | acb1faaa594fc5067c4340e073afca3b83f819d4 (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/identity.php')
| -rw-r--r-- | modules/gallery/helpers/identity.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php index 5f1664ec..5de05948 100644 --- a/modules/gallery/helpers/identity.php +++ b/modules/gallery/helpers/identity.php @@ -66,17 +66,20 @@ class identity_Core { // The installer cannot set a user into the session, so it just sets an id which we should // upconvert into a user. - // @todo set the user name into the session instead of 2 and then use it to get the user object + // @todo set the user name into the session instead of 2 and then use it to get the + // user object if ($user === 2) { 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. |
