mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
比赛相关api都需要登录
This commit is contained in:
parent
1eff6b2abf
commit
a2332b78cd
@ -79,14 +79,15 @@ def check_contest_permission(check_type="details"):
|
|||||||
except Contest.DoesNotExist:
|
except Contest.DoesNotExist:
|
||||||
return self.error("Contest %s doesn't exist" % contest_id)
|
return self.error("Contest %s doesn't exist" % contest_id)
|
||||||
|
|
||||||
|
# Anonymous
|
||||||
|
if not user.is_authenticated():
|
||||||
|
return self.error("Please login first.")
|
||||||
|
|
||||||
# creator or owner
|
# creator or owner
|
||||||
if user.is_authenticated() and user.is_contest_admin(self.contest):
|
if user.is_contest_admin(self.contest):
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
||||||
if self.contest.contest_type == ContestType.PASSWORD_PROTECTED_CONTEST:
|
if self.contest.contest_type == ContestType.PASSWORD_PROTECTED_CONTEST:
|
||||||
# Anonymous
|
|
||||||
if not user.is_authenticated():
|
|
||||||
return self.error("Please login first.")
|
|
||||||
# password error
|
# password error
|
||||||
if self.contest.id not in request.session.get("accessible_contests", []):
|
if self.contest.id not in request.session.get("accessible_contests", []):
|
||||||
return self.error("Password is required.")
|
return self.error("Password is required.")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user