diff --git a/webapp/src/Entity/User.php b/webapp/src/Entity/User.php index 20a54dcfdb..04582c4701 100644 --- a/webapp/src/Entity/User.php +++ b/webapp/src/Entity/User.php @@ -451,7 +451,7 @@ public function getType(): ?string } } - return null; + return $this->getRoleList()[0]; } /** diff --git a/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php b/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php index 58ee2a4fa4..21e4d5603f 100644 --- a/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php +++ b/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php @@ -26,8 +26,8 @@ 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']], @@ -35,7 +35,7 @@ abstract class AccountBaseTestCase extends BaseTestCase 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']], ]; protected static array $optionalAddKeys = ['id', 'name', 'password']; diff --git a/webapp/tests/Unit/Controller/API/AccountControllerTest.php b/webapp/tests/Unit/Controller/API/AccountControllerTest.php index 4e63fd1b54..99024c363b 100644 --- a/webapp/tests/Unit/Controller/API/AccountControllerTest.php +++ b/webapp/tests/Unit/Controller/API/AccountControllerTest.php @@ -22,7 +22,7 @@ class AccountControllerTest extends AccountBaseTestCase "id" => "judgehost", "username" => "judgehost", "team_id" => null, - "type" => null, + "type" => "judgehost", "ip" => null, ], 'demo' => [