Skip to content

Commit

Permalink
remove vistigial module visibility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
robwaz committed Sep 3, 2024
1 parent 591f068 commit 347812c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion dojo_plugin/pages/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions dojo_plugin/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 347812c

Please sign in to comment.