Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package google.registry.ui.server.console;

import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static google.registry.model.console.RegistrarRole.ACCOUNT_MANAGER;
import static google.registry.model.console.RegistrarRole.TECH_CONTACT;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
Expand Down Expand Up @@ -357,12 +356,17 @@ private User updateUserRegistrarRoles(User user, String registrarId, RegistrarRo
return updatedUser;
}

@SuppressWarnings("unchecked")
private ImmutableList<User> getAllRegistrarUsers(String registrarId) {
return tm().transact(
() ->
tm().loadAllOf(User.class).stream()
.filter(u -> u.getUserRoles().getRegistrarRoles().containsKey(registrarId))
.collect(toImmutableList()));
ImmutableList.copyOf(
tm().getEntityManager()
.createNativeQuery(
"SELECT * FROM \"User\" WHERE exist(registrar_roles, :registrarId)",
User.class)
.setParameter("registrarId", registrarId)
.getResultList()));
}

/** Maps a request role string to a RegistrarRole, using ACCOUNT_MANAGER as the default. */
Expand Down
Loading