Skip to content

Commit c8c97ec

Browse files
committed
Don't reference undisclosed problems in clarifications before conteststart
1 parent 8342cf2 commit c8c97ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

webapp/src/Controller/API/ClarificationController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ protected function getQueryBuilder(Request $request): QueryBuilder
309309
}
310310
}
311311

312+
// For non-API-reader users, only expose the problems after the contest has started.
313+
// `WF Access Policy` allows for clarifications before the contest, but not to disclose the problem
314+
// so referencing them in clarifications would violate referential integrity.
315+
if (!$this->dj->checkrole('api_reader')) {
316+
$queryBuilder->andWhere('c.starttime < :now OR clar.problem IS NULL')
317+
->setParameter('now', Utils::now());
318+
}
319+
312320
if ($request->query->has('problem')) {
313321
$queryBuilder
314322
->andWhere('clar.problem = :problem')

0 commit comments

Comments
 (0)