From 1ba2f9c6fd7bbd9611c0ba15efa852220f611627 Mon Sep 17 00:00:00 2001 From: Lyric Law Date: Thu, 16 Jun 2022 08:59:42 +0800 Subject: [PATCH] feat(config): submission not show to all only apply to non-admin users --- submission/views/oj.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/submission/views/oj.py b/submission/views/oj.py index 0f7c4a584..78f32b03a 100644 --- a/submission/views/oj.py +++ b/submission/views/oj.py @@ -143,7 +143,10 @@ def get(self, request): except Problem.DoesNotExist: return self.error("Problem doesn't exist") submissions = submissions.filter(problem=problem) - if (myself and myself == "1") or not SysOptions.submission_list_show_all: + if not SysOptions.submission_list_show_all: + if request.user.is_anonymous or not request.user.is_admin_role(): + submissions = submissions.filter(user_id=request.user.id) + if myself and myself == "1": submissions = submissions.filter(user_id=request.user.id) elif username: submissions = submissions.filter(username__icontains=username)