diff --git a/webapp/src/Controller/API/AccessController.php b/webapp/src/Controller/API/AccessController.php index 546c81a43d..8f4196983e 100644 --- a/webapp/src/Controller/API/AccessController.php +++ b/webapp/src/Controller/API/AccessController.php @@ -49,6 +49,9 @@ public function getStatusAction(Request $request): Access 'icpc_id', 'name', 'formal_name', + // DOMjudge specific properties: + 'affilid', + 'shortname', ]; // Add country data to organizations if supported @@ -56,6 +59,9 @@ public function getStatusAction(Request $request): Access $organizationProperties[] = 'country'; $organizationProperties[] = 'country_flag'; } + if ($this->config->get('show_affiliation_logos')) { + $organizationProperties[] = 'logo'; + } $submissionsProperties = [ 'id', @@ -65,6 +71,9 @@ public function getStatusAction(Request $request): Access 'time', 'contest_time', 'entry_point', + // DOMjudge specific properties: + 'submitid', + 'import_error', ]; // Add files to submissions if allowed @@ -100,9 +109,21 @@ public function getStatusAction(Request $request): Access 'name', 'formal_name', 'start_time', + 'countdown_pause_time', 'duration', 'scoreboard_freeze_duration', + 'scoreboard_thaw_time', + 'scoreboard_type', 'penalty_time', + 'banner', + // DOMjudge specific properties: + 'cid', + 'short_name', + 'end_time', + 'allow_submit', + 'runtime_as_score_tiebreaker', + 'warning_message', + 'problemset', ], ), new AccessEndpoint( @@ -122,9 +143,12 @@ public function getStatusAction(Request $request): Access 'entry_point_required', 'entry_point_name', 'extensions', - // TODO: we don't support these yet -// 'compiler.command', -// 'runner.command', + 'compiler', + 'runner', + // DOMjudge specific properties: + 'allow_judge', + 'time_factor', + 'filter_compiler_files', ], ), new AccessEndpoint( @@ -139,6 +163,8 @@ public function getStatusAction(Request $request): Access 'time_limit', 'test_data_count', 'statement', + // DOMjudge specific properties: + 'probid', ], ), new AccessEndpoint( @@ -148,6 +174,11 @@ public function getStatusAction(Request $request): Access 'icpc_id', 'name', 'hidden', + // DOMjudge specific properties: + 'categoryid', + 'sortorder', + 'color', + 'allow_self_registration', ], ), new AccessEndpoint( @@ -160,9 +191,39 @@ public function getStatusAction(Request $request): Access 'id', 'icpc_id', 'name', + 'label', 'display_name', 'organization_id', 'group_ids', + 'hidden', + 'location', + 'photo', + // DOMjudge specific properties: + 'teamid', + 'affiliation', + 'nationality', + 'public_description', + ] + ), + new AccessEndpoint( + type: 'accounts', + properties: [ + 'id', + 'username', + 'name', + 'type', + 'ip', + 'team_id', + // DOMjudge specific properties: + 'first_login_time', + 'last_login_time', + 'last_api_login_time', + 'team', + 'roles', + 'userid', + 'email', + 'last_ip', + 'enabled', ] ), new AccessEndpoint( @@ -191,6 +252,8 @@ public function getStatusAction(Request $request): Access 'end_time', 'end_contest_time', 'max_run_time', + // DOMjudge specific properties: + 'valid', ], ), new AccessEndpoint( @@ -205,6 +268,22 @@ public function getStatusAction(Request $request): Access 'run_time', ], ), + new AccessEndpoint( + type: 'clarifications', + properties: [ + 'id', + 'from_team_id', + 'to_team_id', + 'reply_to_id', + 'problem_id', + 'text', + 'time', + 'contest_time', + // DOMjudge specific properties: + 'clarid', + 'answered', + ], + ), new AccessEndpoint( type: 'awards', properties: [ diff --git a/webapp/src/Entity/Problem.php b/webapp/src/Entity/Problem.php index 343e7ec4f3..688063fec9 100644 --- a/webapp/src/Entity/Problem.php +++ b/webapp/src/Entity/Problem.php @@ -111,6 +111,7 @@ class Problem extends BaseApiEntity implements /** * @var array */ + #[Serializer\Exclude] private array $typesToString = [ self::TYPE_PASS_FAIL => 'pass-fail', self::TYPE_SCORING => 'scoring', diff --git a/webapp/tests/Unit/Controller/API/AccessControllerTest.php b/webapp/tests/Unit/Controller/API/AccessControllerTest.php index 433dcf84f0..3831faa8a9 100644 --- a/webapp/tests/Unit/Controller/API/AccessControllerTest.php +++ b/webapp/tests/Unit/Controller/API/AccessControllerTest.php @@ -36,10 +36,12 @@ public function testAccessAsAdmin(): void 'groups' => ['id', 'icpc_id', 'name', 'hidden'], 'organizations' => ['id', 'icpc_id', 'name', 'formal_name', 'country', 'country_flag'], 'teams' => ['id', 'icpc_id', 'name', 'display_name', 'organization_id', 'group_ids'], + 'accounts' => ['id', 'username', 'name', 'type'], 'state' => ['started', 'frozen', 'ended', 'thawed', 'finalized', 'end_of_updates'], 'submissions' => ['id', 'language_id', 'problem_id', 'team_id', 'time', 'contest_time', 'entry_point', 'files'], 'judgements' => ['id', 'submission_id', 'judgement_type_id', 'start_time', 'start_contest_time', 'end_time', 'end_contest_time', 'max_run_time'], 'runs' => ['id', 'judgement_id', 'ordinal', 'judgement_type_id', 'time', 'contest_time', 'run_time'], + 'clarifications' => ['id', 'from_team_id', 'problem_id', 'text', 'time', 'contest_time'], 'awards' => ['id', 'citation', 'team_ids'], ]; @@ -54,7 +56,9 @@ public function testAccessAsAdmin(): void break; } } - self::assertSame($expectedProperties, $actualProperties); + foreach ($expectedProperties as $property) { + self::assertContains($property, $actualProperties); + } } } }