Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 82 additions & 3 deletions webapp/src/Controller/API/AccessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ public function getStatusAction(Request $request): Access
'icpc_id',
'name',
'formal_name',
// DOMjudge specific properties:
'affilid',
'shortname',
];

// Add country data to organizations if supported
if ($this->config->get('show_flags')) {
$organizationProperties[] = 'country';
$organizationProperties[] = 'country_flag';
}
if ($this->config->get('show_affiliation_logos')) {
$organizationProperties[] = 'logo';
}

$submissionsProperties = [
'id',
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -139,6 +163,8 @@ public function getStatusAction(Request $request): Access
'time_limit',
'test_data_count',
'statement',
// DOMjudge specific properties:
'probid',
],
),
new AccessEndpoint(
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -191,6 +252,8 @@ public function getStatusAction(Request $request): Access
'end_time',
'end_contest_time',
'max_run_time',
// DOMjudge specific properties:
'valid',
],
),
new AccessEndpoint(
Expand All @@ -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: [
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Entity/Problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class Problem extends BaseApiEntity implements
/**
* @var array<int, string>
*/
#[Serializer\Exclude]
private array $typesToString = [
self::TYPE_PASS_FAIL => 'pass-fail',
self::TYPE_SCORING => 'scoring',
Expand Down
6 changes: 5 additions & 1 deletion webapp/tests/Unit/Controller/API/AccessControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
];

Expand All @@ -54,7 +56,9 @@ public function testAccessAsAdmin(): void
break;
}
}
self::assertSame($expectedProperties, $actualProperties);
foreach ($expectedProperties as $property) {
self::assertContains($property, $actualProperties);
}
}
}
}
Loading