Skip to content

Commit 2794f15

Browse files
committed
CWS: Allow admin to override the contest phase check
1 parent 99a1a18 commit 2794f15

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

cms/server/contest/phase_management.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,14 @@ def decorator(
220220
) -> Callable[typing.Concatenate[_Self, _P], _R | None]:
221221
@wraps(func)
222222
def wrapped(self: _Self, *args: _P.args, **kwargs: _P.kwargs):
223-
if self.r_params["actual_phase"] not in actual_phases and \
224-
(self.current_user is None or
225-
not self.current_user.unrestricted):
223+
unrestricted = self.current_user is not None and self.current_user.unrestricted
224+
if self.impersonated_by_admin:
225+
try:
226+
unrestricted = self.get_boolean_argument("override_phase_check", unrestricted)
227+
except ValueError as err:
228+
self.json({"error": str(err)}, 400)
229+
return
230+
if self.r_params["actual_phase"] not in actual_phases and not unrestricted:
226231
if self.is_api():
227232
if set(actual_phases) <= {0, 3}:
228233
self.json({"error": "The contest is not open"}, 403)

0 commit comments

Comments
 (0)