Skip to content

Commit ee5a2d3

Browse files
authored
Include internal registrars in the console (#2821)
This allows us to also check / modify the CharlestonRoad registrar in the console, and also allows us to test actions (like password reset) using that registrar in the prod environment.
1 parent 2b5643d commit ee5a2d3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/src/main/java/google/registry/ui/server/console/RegistrarsAction.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
public class RegistrarsAction extends ConsoleApiAction {
5454
private static final int PASSWORD_LENGTH = 16;
5555
private static final int PASSCODE_LENGTH = 5;
56-
private static final ImmutableList<Registrar.Type> allowedRegistrarTypes =
57-
ImmutableList.of(Registrar.Type.REAL, Registrar.Type.OTE);
56+
private static final ImmutableSet<Registrar.Type> TYPES_ALLOWED_FOR_USERS =
57+
ImmutableSet.of(Registrar.Type.REAL, Registrar.Type.OTE);
58+
private static final ImmutableSet<Registrar.Type> TYPES_ALLOWED_FOR_ADMINS =
59+
ImmutableSet.of(Registrar.Type.INTERNAL, Registrar.Type.REAL, Registrar.Type.OTE);
5860
private static final String SQL_TEMPLATE =
5961
"""
6062
SELECT * FROM "Registrar"
@@ -80,6 +82,8 @@ public RegistrarsAction(
8082
@Override
8183
protected void getHandler(User user) {
8284
if (user.getUserRoles().hasGlobalPermission(ConsolePermission.VIEW_REGISTRARS)) {
85+
ImmutableSet<Registrar.Type> allowedRegistrarTypes =
86+
user.getUserRoles().isAdmin() ? TYPES_ALLOWED_FOR_ADMINS : TYPES_ALLOWED_FOR_USERS;
8387
ImmutableList<Registrar> registrars =
8488
Streams.stream(Registrar.loadAll())
8589
.filter(r -> allowedRegistrarTypes.contains(r.getType()))
@@ -94,6 +98,7 @@ protected void getHandler(User user) {
9498
.map(Map.Entry::getKey)
9599
.collect(toImmutableSet());
96100

101+
@SuppressWarnings("unchecked")
97102
List<Registrar> registrars =
98103
tm().transact(
99104
() ->

0 commit comments

Comments
 (0)