From 347812c75da9fb0077a735dacc18380c10a1a2b0 Mon Sep 17 00:00:00 2001 From: Robert Wasinger Date: Wed, 28 Aug 2024 20:34:11 -0700 Subject: [PATCH] remove vistigial module visibility functions --- dojo_plugin/pages/course.py | 2 +- dojo_plugin/utils/__init__.py | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/dojo_plugin/pages/course.py b/dojo_plugin/pages/course.py index 6c827a2a..f58ca40d 100644 --- a/dojo_plugin/pages/course.py +++ b/dojo_plugin/pages/course.py @@ -10,7 +10,7 @@ from CTFd.utils.decorators import authed_only, admins_only, ratelimit from ..models import DiscordUsers, DojoChallenges, DojoUsers, DojoStudents, DojoModules, DojoStudents -from ..utils import module_visible, module_challenges_visible, is_dojo_admin +from ..utils import is_dojo_admin from ..utils.dojo import dojo_route from ..utils.discord import add_role, get_discord_member from .writeups import WriteupComments, writeup_weeks, all_writeups diff --git a/dojo_plugin/utils/__init__.py b/dojo_plugin/utils/__init__.py index 19fe47af..98c03652 100644 --- a/dojo_plugin/utils/__init__.py +++ b/dojo_plugin/utils/__init__.py @@ -167,23 +167,6 @@ def resolved_tar(dir, *, root_dir, filter=None): return tar_buffer -def module_visible(dojo, module, user): - return ( - "visibility" not in module or - module["visibility"]["start"] <= datetime.datetime.now(pytz.utc) or - is_dojo_admin(user, dojo) - ) - - -def module_challenges_visible(dojo, module, user): - return ( - ("time_assigned" not in module and "visibility" not in module) or - ("time_assigned" in module and module["time_assigned"] <= datetime.datetime.now(pytz.utc)) or - ("visibility" in module and module["visibility"] <= datetime.datetime.now(pytz.utc)) or - is_dojo_admin(user, dojo) - ) - - def is_dojo_admin(user, dojo): return user and dojo and dojo.is_admin(user)