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 ] + ); + } + }