Skip to content
Closed
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
2 changes: 1 addition & 1 deletion webapp/src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ public function getType(): ?string
}
}

return null;
return $this->getRoleList()[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this list guaranteed to be non empty?

}

/**
Expand Down
6 changes: 3 additions & 3 deletions webapp/tests/Unit/Controller/API/AccountBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ abstract class AccountBaseTestCase extends BaseTestCase
[['type' => 'api_writer'], ['type' => 'admin', 'roles' => ['api_writer']]],
[['type' => 'api_reader'], ['type' => 'admin', 'roles' => ['api_reader']]],
[['type' => 'api_source_reader'], ['type' => 'judge', 'roles' => ['api_source_reader']]],
[['type' => 'balloon'], ['roles' => ['balloon'], 'type' => null]],
[['type' => 'clarification_rw'], ['roles' => ['clarification_rw'], 'type' => null]],
[['type' => 'balloon'], ['roles' => ['balloon']]],
[['type' => 'clarification_rw'], ['roles' => ['clarification_rw']]],
[['type' => 'cds'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
[['username' => 'cds', 'type' => 'admin'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
[['username' => 'cds', 'type' => 'jury'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
];

protected static array $accountAddCombinationsWithoutFile = [
[['username' => 'cds', 'roles' => ['admin']], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => null]],
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => 'judgehost']],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => 'judgehost']],
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => 'dj_judgehost']],

];

protected static array $optionalAddKeys = ['id', 'name', 'password'];
Expand Down
2 changes: 1 addition & 1 deletion webapp/tests/Unit/Controller/API/AccountControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AccountControllerTest extends AccountBaseTestCase
"id" => "judgehost",
"username" => "judgehost",
"team_id" => null,
"type" => null,
"type" => "judgehost",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"type" => "judgehost",
"type" => "dj_judgehost",

This is so specific to DOMjudge that prefixing is better in case it ever ends up in another system...

"ip" => null,
],
'demo' => [
Expand Down
Loading