Skip to content

Commit 7b92d54

Browse files
When no mapping to CLICS role exists, map to first role
Fixes #3163
1 parent eedd68a commit 7b92d54

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

webapp/src/Entity/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public function getType(): ?string
451451
}
452452
}
453453

454-
return null;
454+
return $this->getRoleList()[0];
455455
}
456456

457457
/**

webapp/tests/Unit/Controller/API/AccountBaseTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ abstract class AccountBaseTestCase extends BaseTestCase
2626
[['type' => 'api_writer'], ['type' => 'admin', 'roles' => ['api_writer']]],
2727
[['type' => 'api_reader'], ['type' => 'admin', 'roles' => ['api_reader']]],
2828
[['type' => 'api_source_reader'], ['type' => 'judge', 'roles' => ['api_source_reader']]],
29-
[['type' => 'balloon'], ['roles' => ['balloon'], 'type' => null]],
30-
[['type' => 'clarification_rw'], ['roles' => ['clarification_rw'], 'type' => null]],
29+
[['type' => 'balloon'], ['roles' => ['balloon']]],
30+
[['type' => 'clarification_rw'], ['roles' => ['clarification_rw']]],
3131
[['type' => 'cds'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
3232
[['username' => 'cds', 'type' => 'admin'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
3333
[['username' => 'cds', 'type' => 'jury'], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
3434
];
3535

3636
protected static array $accountAddCombinationsWithoutFile = [
3737
[['username' => 'cds', 'roles' => ['admin']], ['roles' => ['api_source_reader', 'api_reader', 'api_writer'], 'type' => 'admin']],
38-
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => null]],
38+
[['username' => 'another_judgehost', 'roles' => ['judgehost']], ['type' => 'judgehost']],
3939
];
4040

4141
protected static array $optionalAddKeys = ['id', 'name', 'password'];

webapp/tests/Unit/Controller/API/AccountControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AccountControllerTest extends AccountBaseTestCase
2222
"id" => "judgehost",
2323
"username" => "judgehost",
2424
"team_id" => null,
25-
"type" => null,
25+
"type" => "judgehost",
2626
"ip" => null,
2727
],
2828
'demo' => [

0 commit comments

Comments
 (0)