1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-10-24 12:26:05 +02:00

Regularly resynchronize session data with authoritative source in DB

This commit is contained in:
Marco
2018-03-10 20:53:13 +01:00
parent a1ae66374b
commit 21341d3c18
2 changed files with 50 additions and 1 deletions

View File

@@ -38,6 +38,8 @@ abstract class UserManager {
const SESSION_FIELD_ROLES = 'auth_roles';
/** @var string session field for whether the user who is currently signed in (if any) has been remembered (instead of them having authenticated actively) */
const SESSION_FIELD_REMEMBERED = 'auth_remembered';
/** @var string session field for the UNIX timestamp in seconds of the session data's last resynchronization with its authoritative source in the database */
const SESSION_FIELD_LAST_RESYNC = 'auth_last_resync';
/** @var PdoDatabase the database connection to operate on */
protected $db;
@@ -205,6 +207,7 @@ abstract class UserManager {
$_SESSION[self::SESSION_FIELD_STATUS] = (int) $status;
$_SESSION[self::SESSION_FIELD_ROLES] = (int) $roles;
$_SESSION[self::SESSION_FIELD_REMEMBERED] = $remembered;
$_SESSION[self::SESSION_FIELD_LAST_RESYNC] = \time();
}
/**