Skip to content

Commit

Permalink
chore(server): allow admin bypass rules (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
thezzisu authored Mar 31, 2024
1 parent eb352f4 commit dd6da01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/f97c48cf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@aoi-js/server": 1.1.0-alpha.6
4 changes: 2 additions & 2 deletions apps/server/src/routes/contest/solution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const solutionScopedRoutes = defineRoutes(async (s) => {
})
if (!solution) throw s.httpErrors.notFound()
const { solutionShowOtherData } = ctx._contestStage.settings
let showData = checkUser(req, solution.userId, solutionShowOtherData)
let showData = !!solutionShowOtherData
if (ctx._contest.rules?.solution) {
;({ showData } = solutionRuleEvaluator(
{
Expand All @@ -232,7 +232,7 @@ const solutionScopedRoutes = defineRoutes(async (s) => {
{ showData }
))
}
if (!showData) throw s.httpErrors.forbidden()
if (!checkUser(req, solution.userId, showData)) throw s.httpErrors.forbidden()
return [ctx._contest.orgId, solutionDataKey(solution._id)]
},
allowedTypes: ['download']
Expand Down

0 comments on commit dd6da01

Please sign in to comment.