From 58f1f3459380765b07af3c36df1ea55dcec47e40 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 24 Mar 2018 23:39:03 +0100 Subject: [PATCH] Implement method 'forceLogoutForUserById' in class 'UserManager' --- src/UserManager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/UserManager.php b/src/UserManager.php index 4c1a845..94f7716 100644 --- a/src/UserManager.php +++ b/src/UserManager.php @@ -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 ] + ); + } + }