mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Only show OT&E admin actions when not in production environment
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=237061813
This commit is contained in:
parent
d42eeb3755
commit
204cb8e886
10 changed files with 38 additions and 19 deletions
|
@ -54,12 +54,15 @@ registry.registrar.AdminSettings.prototype.bindToDom = function(id) {
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
registry.registrar.AdminSettings.prototype.runAfterRender = function(objArgs) {
|
registry.registrar.AdminSettings.prototype.runAfterRender = function(objArgs) {
|
||||||
|
const oteButton = goog.dom.getElement('btn-ote-status');
|
||||||
|
if (oteButton) {
|
||||||
goog.events.listen(
|
goog.events.listen(
|
||||||
goog.dom.getRequiredElement('btn-ote-status'),
|
oteButton,
|
||||||
goog.events.EventType.CLICK,
|
goog.events.EventType.CLICK,
|
||||||
goog.bind(
|
goog.bind(
|
||||||
this.oteStatusCheck_, this, objArgs.xsrfToken, objArgs.clientId),
|
this.oteStatusCheck_, this, objArgs.xsrfToken, objArgs.clientId),
|
||||||
false, this);
|
false, this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
|
|
|
@ -36,11 +36,13 @@ goog.require('registry.registrar.Console');
|
||||||
* @param {string} announcementsEmail
|
* @param {string} announcementsEmail
|
||||||
* @param {string} supportPhoneNumber
|
* @param {string} supportPhoneNumber
|
||||||
* @param {string} technicalDocsUrl
|
* @param {string} technicalDocsUrl
|
||||||
|
* @param {string} environment
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
registry.registrar.main = function(
|
registry.registrar.main = function(
|
||||||
xsrfToken, clientId, isAdmin, isOwner, productName, integrationEmail,
|
xsrfToken, clientId, isAdmin, isOwner, productName, integrationEmail,
|
||||||
supportEmail, announcementsEmail, supportPhoneNumber, technicalDocsUrl) {
|
supportEmail, announcementsEmail, supportPhoneNumber, technicalDocsUrl,
|
||||||
|
environment) {
|
||||||
const console = new registry.registrar.Console({
|
const console = new registry.registrar.Console({
|
||||||
xsrfToken: xsrfToken,
|
xsrfToken: xsrfToken,
|
||||||
clientId: clientId,
|
clientId: clientId,
|
||||||
|
@ -51,7 +53,8 @@ registry.registrar.main = function(
|
||||||
supportEmail: supportEmail,
|
supportEmail: supportEmail,
|
||||||
announcementsEmail: announcementsEmail,
|
announcementsEmail: announcementsEmail,
|
||||||
supportPhoneNumber: supportPhoneNumber,
|
supportPhoneNumber: supportPhoneNumber,
|
||||||
technicalDocsUrl: technicalDocsUrl
|
technicalDocsUrl: technicalDocsUrl,
|
||||||
|
environment: environment,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.setUp();
|
console.setUp();
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.google.template.soy.data.SoyMapData;
|
||||||
import com.google.template.soy.shared.SoyCssRenamingMap;
|
import com.google.template.soy.shared.SoyCssRenamingMap;
|
||||||
import com.google.template.soy.tofu.SoyTofu;
|
import com.google.template.soy.tofu.SoyTofu;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
import google.registry.request.Response;
|
import google.registry.request.Response;
|
||||||
|
@ -76,6 +77,7 @@ public final class ConsoleUiAction implements Runnable {
|
||||||
@Inject UserService userService;
|
@Inject UserService userService;
|
||||||
@Inject XsrfTokenManager xsrfTokenManager;
|
@Inject XsrfTokenManager xsrfTokenManager;
|
||||||
@Inject AuthResult authResult;
|
@Inject AuthResult authResult;
|
||||||
|
@Inject RegistryEnvironment environment;
|
||||||
@Inject @Config("logoFilename") String logoFilename;
|
@Inject @Config("logoFilename") String logoFilename;
|
||||||
@Inject @Config("productName") String productName;
|
@Inject @Config("productName") String productName;
|
||||||
@Inject @Config("integrationEmail") String integrationEmail;
|
@Inject @Config("integrationEmail") String integrationEmail;
|
||||||
|
@ -133,6 +135,7 @@ public final class ConsoleUiAction implements Runnable {
|
||||||
data.put("xsrfToken", xsrfTokenManager.generateToken(user.getEmail()));
|
data.put("xsrfToken", xsrfTokenManager.generateToken(user.getEmail()));
|
||||||
ImmutableSetMultimap<String, Role> roleMap = registrarAccessor.getAllClientIdWithRoles();
|
ImmutableSetMultimap<String, Role> roleMap = registrarAccessor.getAllClientIdWithRoles();
|
||||||
data.put("allClientIds", roleMap.keySet());
|
data.put("allClientIds", roleMap.keySet());
|
||||||
|
data.put("environment", environment.toString());
|
||||||
// We set the initual value to the value that will show if guessClientId throws.
|
// We set the initual value to the value that will show if guessClientId throws.
|
||||||
String clientId = "<null>";
|
String clientId = "<null>";
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
{template .settings}
|
{template .settings}
|
||||||
{@param allowedTlds: list<string>}
|
{@param allowedTlds: list<string>}
|
||||||
{@param type: string} // the registrar type, e.g. REAL, OTE, TEST, etc.
|
{@param type: string} // the registrar type, e.g. REAL, OTE, TEST, etc.
|
||||||
|
{@param environment: string} // the server environment e.g. PRODUCTION, SANDBOX
|
||||||
<form name="item" class="{css('item')} {css('registrar')}">
|
<form name="item" class="{css('item')} {css('registrar')}">
|
||||||
<h1>Administrator settings</h1>
|
<h1>Administrator settings</h1>
|
||||||
<table>
|
<table>
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
class="{css('kd-button')} {css('btn-add')}">Add</button>
|
class="{css('kd-button')} {css('btn-add')}">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{if $environment != 'PRODUCTION'}
|
||||||
<tr class="{css('kd-settings-pane-section')}">
|
<tr class="{css('kd-settings-pane-section')}">
|
||||||
<td>
|
<td>
|
||||||
<label class="{css('setting-label')}">OT&E setup page</label>
|
<label class="{css('setting-label')}">OT&E setup page</label>
|
||||||
|
@ -49,9 +51,12 @@
|
||||||
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
||||||
</p></td>
|
</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{if $type == 'OTE'}
|
||||||
{call .oteStatus}
|
{call .oteStatus}
|
||||||
{param registrarType: $type /}
|
{param registrarType: $type /}
|
||||||
{/call}
|
{/call}
|
||||||
|
{/if}
|
||||||
<tr class="{css('kd-settings-pane-section')}">
|
<tr class="{css('kd-settings-pane-section')}">
|
||||||
<td>
|
<td>
|
||||||
<label class="{css('setting-label')}">Create new registrar</label>
|
<label class="{css('setting-label')}">Create new registrar</label>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
{@param announcementsEmail: string}
|
{@param announcementsEmail: string}
|
||||||
{@param supportPhoneNumber: string}
|
{@param supportPhoneNumber: string}
|
||||||
{@param technicalDocsUrl: string}
|
{@param technicalDocsUrl: string}
|
||||||
|
{@param environment: string}
|
||||||
|
|
||||||
{call registry.soy.console.header}
|
{call registry.soy.console.header}
|
||||||
{param app: 'registrar' /}
|
{param app: 'registrar' /}
|
||||||
|
@ -82,7 +83,8 @@
|
||||||
{$supportEmail},
|
{$supportEmail},
|
||||||
{$announcementsEmail},
|
{$announcementsEmail},
|
||||||
{$supportPhoneNumber},
|
{$supportPhoneNumber},
|
||||||
{$technicalDocsUrl});
|
{$technicalDocsUrl},
|
||||||
|
{$environment});
|
||||||
</script>
|
</script>
|
||||||
{/if}
|
{/if}
|
||||||
{/template}
|
{/template}
|
||||||
|
|
|
@ -60,6 +60,7 @@ registry.registrar.ConsoleTestUtil.renderConsoleMain = function(
|
||||||
announcementsEmail: args.announcementsEmail || 'announcement@example.com',
|
announcementsEmail: args.announcementsEmail || 'announcement@example.com',
|
||||||
supportPhoneNumber: args.supportPhoneNumber || '+1 (888) 555 0123',
|
supportPhoneNumber: args.supportPhoneNumber || '+1 (888) 555 0123',
|
||||||
technicalDocsUrl: args.technicalDocsUrl || 'http://example.com/techdocs',
|
technicalDocsUrl: args.technicalDocsUrl || 'http://example.com/techdocs',
|
||||||
|
environment: args.environment || 'UNITTEST',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.google.appengine.api.users.User;
|
||||||
import com.google.appengine.api.users.UserServiceFactory;
|
import com.google.appengine.api.users.UserServiceFactory;
|
||||||
import com.google.common.collect.ImmutableSetMultimap;
|
import com.google.common.collect.ImmutableSetMultimap;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.request.auth.AuthLevel;
|
import google.registry.request.auth.AuthLevel;
|
||||||
import google.registry.request.auth.AuthResult;
|
import google.registry.request.auth.AuthResult;
|
||||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
||||||
|
@ -78,6 +79,7 @@ public class ConsoleUiActionTest {
|
||||||
action.paramClientId = Optional.empty();
|
action.paramClientId = Optional.empty();
|
||||||
AuthResult authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, false));
|
AuthResult authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, false));
|
||||||
action.authResult = authResult;
|
action.authResult = authResult;
|
||||||
|
action.environment = RegistryEnvironment.UNITTEST;
|
||||||
|
|
||||||
action.registrarAccessor =
|
action.registrarAccessor =
|
||||||
AuthenticatedRegistrarAccessor.createForTesting(
|
AuthenticatedRegistrarAccessor.createForTesting(
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 50 KiB |
Binary file not shown.
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 52 KiB |
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
Loading…
Add table
Add a link
Reference in a new issue