Change values of AUTH_ to allow intermediate values.
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
* 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.
/*** 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();
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.