summaryrefslogtreecommitdiff
path: root/inc/auth
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-02-15 13:17:16 +0100
committerAndreas Gohr <andi@splitbrain.org>2008-02-15 13:17:16 +0100
commit7172dbc0d546b2eec19b87ad2b9812242fa2219d (patch)
tree63b28d0c6d75cb12720f0475dc3502fe7bcc3fe2 /inc/auth
parent9ec826364ada5906c775152c1f681292ffea1b92 (diff)
downloadrpg-7172dbc0d546b2eec19b87ad2b9812242fa2219d.tar.gz
rpg-7172dbc0d546b2eec19b87ad2b9812242fa2219d.tar.bz2
Make session reference file check overridable for auth backends
darcs-hash:20080215121716-7ad00-35d275212e0e3c41626ed64d9096aad10f4ad2db.gz
Diffstat (limited to 'inc/auth')
-rw-r--r--inc/auth/basic.class.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/inc/auth/basic.class.php b/inc/auth/basic.class.php
index bf251bae0..c3bb9d32e 100644
--- a/inc/auth/basic.class.php
+++ b/inc/auth/basic.class.php
@@ -290,5 +290,35 @@ class auth_basic {
return array();
}
+ /**
+ * Check Session Cache validity [implement only where required/possible]
+ *
+ * DokuWiki caches user info in the user's session for the timespan defined
+ * in $conf['securitytimeout'].
+ *
+ * This makes sure slow authentication backends do not slow down DokuWiki.
+ * This also means that changes to the user database will not be reflected
+ * on currently logged in users.
+ *
+ * To accommodate for this, the user manager plugin will touch a reference
+ * file whenever a change is submitted. This function compares the filetime
+ * of this reference file with the time stored in the session.
+ *
+ * This reference file mechanism does not reflect changes done directly in
+ * the backend's database through other means than the user manager plugin.
+ *
+ * Fast backends might want to return always false, to force rechecks on
+ * each page load. Others might want to use their own checking here. If
+ * unsure, do not override.
+ *
+ * @param string $user - The username
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @return bool
+ */
+ function useSessionCache($user){
+ global $conf;
+ return ($_SESSION[DOKU_COOKIE]['auth']['time'] >= @filemtime($conf['cachedir'].'/sessionpurge'));
+ }
+
}
//Setup VIM: ex: et ts=2 enc=utf-8 :