1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-02 14:17:26 +02:00

Implement method 'forceLogoutForUserById' in class 'UserManager'

This commit is contained in:
Marco
2018-03-24 23:39:03 +01:00
parent 4d7b66ee5a
commit 58f1f34593

View File

@@ -394,4 +394,18 @@ abstract class UserManager {
} }
} }
/**
* Triggers a forced logout in all sessions that belong to the specified user
*
* @param int $userId the ID of the user to sign out
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
protected function forceLogoutForUserById($userId) {
$this->deleteRememberDirectiveForUserById($userId);
$this->db->exec(
'UPDATE ' . $this->dbTablePrefix . 'users SET force_logout = force_logout + 1 WHERE id = ?',
[ $userId ]
);
}
} }