From e65d60bed16a6a4a5d0f73ca35b8b2d4afa506c8 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Mon, 4 May 2020 03:44:02 -0400 Subject: [PATCH] Add function mass clear user/team sessions --- CTFd/cache/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CTFd/cache/__init__.py b/CTFd/cache/__init__.py index 19d8047..9ea10e0 100644 --- a/CTFd/cache/__init__.py +++ b/CTFd/cache/__init__.py @@ -58,7 +58,19 @@ def clear_user_session(user_id): cache.delete_memoized(get_user_attrs, user_id=user_id) +def clear_all_user_sessions(): + from CTFd.utils.user import get_user_attrs + + cache.delete_memoized(get_user_attrs) + + def clear_team_session(team_id): from CTFd.utils.user import get_team_attrs cache.delete_memoized(get_team_attrs, team_id=team_id) + + +def clear_all_team_sessions(): + from CTFd.utils.user import get_team_attrs + + cache.delete_memoized(get_team_attrs)