From 8cd8f58b0e58ee8ebc2ebf1bb79f2e20eb05808d Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 17 Aug 2008 12:38:53 +0200 Subject: [PATCH] S::logged() depends of a PlSession parameter. Change values of AUTH_ to allow intermediate values. Signed-off-by: Florent Bruneau --- classes/plsession.php | 8 ++++++-- classes/s.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/classes/plsession.php b/classes/plsession.php index f576f65..bc5f508 100644 --- a/classes/plsession.php +++ b/classes/plsession.php @@ -24,8 +24,8 @@ * but can be overwritten by others auth levels definitions. */ define('AUTH_PUBLIC', 0); -define('AUTH_COOKIE', 1); -define('AUTH_MDP', 2); +define('AUTH_COOKIE', 5); +define('AUTH_MDP', 10); /** The PlSession is a wrapper around the user session management. @@ -206,6 +206,10 @@ abstract class PlSession /*** Thresholds ***/ + /** Minimum level of authentication that is considered as logged. + */ + abstract public function loggedLevel(); + /** Minimum level of authentication that is considered as sure. */ abstract public function sureLevel(); diff --git a/classes/s.php b/classes/s.php index 9be89a7..030cca9 100644 --- a/classes/s.php +++ b/classes/s.php @@ -109,12 +109,12 @@ class S public static function logged() { - return S::v('auth', AUTH_PUBLIC) > AUTH_PUBLIC; + return S::i('auth', AUTH_PUBLIC) >= Platal::session()->loggedLevel(); } public static function identified() { - return S::v('auth', AUTH_PUBLIC) >= Platal::session()->sureLevel(); + return S::i('auth', AUTH_PUBLIC) >= Platal::session()->sureLevel(); } // Anti-XSRF protections. -- 2.1.4