mirror of
https://github.com/google/nomulus.git
synced 2025-07-26 04:28:34 +02:00
Allow admins to access registrar console without a RegistrarContact
This allows admins to access the registrar console without needing to be added as a registrar contact. If they are a registrar contact, then that registrar takes precedence. Tested=In Alpha ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164182623
This commit is contained in:
parent
151ae2558f
commit
f3919e056d
9 changed files with 308 additions and 69 deletions
|
@ -70,8 +70,9 @@ public class ConsoleUiActionTest {
|
|||
action.sessionUtils = sessionUtils;
|
||||
action.userService = UserServiceFactory.getUserService();
|
||||
action.xsrfTokenManager = new XsrfTokenManager(new FakeClock(), action.userService);
|
||||
action.authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, false));
|
||||
when(sessionUtils.checkRegistrarConsoleLogin(request, user)).thenReturn(true);
|
||||
UserAuthInfo userAuthInfo = UserAuthInfo.create(user, false);
|
||||
action.authResult = AuthResult.create(AuthLevel.USER, userAuthInfo);
|
||||
when(sessionUtils.checkRegistrarConsoleLogin(request, userAuthInfo)).thenReturn(true);
|
||||
when(sessionUtils.getRegistrarClientId(request)).thenReturn("TheRegistrar");
|
||||
}
|
||||
|
||||
|
@ -109,7 +110,8 @@ public class ConsoleUiActionTest {
|
|||
|
||||
@Test
|
||||
public void testUserDoesntHaveAccessToAnyRegistrar_showsWhoAreYouPage() throws Exception {
|
||||
when(sessionUtils.checkRegistrarConsoleLogin(any(HttpServletRequest.class), any(User.class)))
|
||||
when(sessionUtils.checkRegistrarConsoleLogin(
|
||||
any(HttpServletRequest.class), any(UserAuthInfo.class)))
|
||||
.thenReturn(false);
|
||||
action.run();
|
||||
assertThat(response.getPayload()).contains("<h1>You need permission</h1>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue