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 */
|
||||
registry.registrar.AdminSettings.prototype.runAfterRender = function(objArgs) {
|
||||
goog.events.listen(
|
||||
goog.dom.getRequiredElement('btn-ote-status'),
|
||||
goog.events.EventType.CLICK,
|
||||
goog.bind(
|
||||
this.oteStatusCheck_, this, objArgs.xsrfToken, objArgs.clientId),
|
||||
false, this);
|
||||
const oteButton = goog.dom.getElement('btn-ote-status');
|
||||
if (oteButton) {
|
||||
goog.events.listen(
|
||||
oteButton,
|
||||
goog.events.EventType.CLICK,
|
||||
goog.bind(
|
||||
this.oteStatusCheck_, this, objArgs.xsrfToken, objArgs.clientId),
|
||||
false, this);
|
||||
}
|
||||
};
|
||||
|
||||
/** @override */
|
||||
|
|
|
@ -36,11 +36,13 @@ goog.require('registry.registrar.Console');
|
|||
* @param {string} announcementsEmail
|
||||
* @param {string} supportPhoneNumber
|
||||
* @param {string} technicalDocsUrl
|
||||
* @param {string} environment
|
||||
* @export
|
||||
*/
|
||||
registry.registrar.main = function(
|
||||
xsrfToken, clientId, isAdmin, isOwner, productName, integrationEmail,
|
||||
supportEmail, announcementsEmail, supportPhoneNumber, technicalDocsUrl) {
|
||||
supportEmail, announcementsEmail, supportPhoneNumber, technicalDocsUrl,
|
||||
environment) {
|
||||
const console = new registry.registrar.Console({
|
||||
xsrfToken: xsrfToken,
|
||||
clientId: clientId,
|
||||
|
@ -51,7 +53,8 @@ registry.registrar.main = function(
|
|||
supportEmail: supportEmail,
|
||||
announcementsEmail: announcementsEmail,
|
||||
supportPhoneNumber: supportPhoneNumber,
|
||||
technicalDocsUrl: technicalDocsUrl
|
||||
technicalDocsUrl: technicalDocsUrl,
|
||||
environment: environment,
|
||||
});
|
||||
|
||||
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.tofu.SoyTofu;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
|
@ -76,6 +77,7 @@ public final class ConsoleUiAction implements Runnable {
|
|||
@Inject UserService userService;
|
||||
@Inject XsrfTokenManager xsrfTokenManager;
|
||||
@Inject AuthResult authResult;
|
||||
@Inject RegistryEnvironment environment;
|
||||
@Inject @Config("logoFilename") String logoFilename;
|
||||
@Inject @Config("productName") String productName;
|
||||
@Inject @Config("integrationEmail") String integrationEmail;
|
||||
|
@ -133,6 +135,7 @@ public final class ConsoleUiAction implements Runnable {
|
|||
data.put("xsrfToken", xsrfTokenManager.generateToken(user.getEmail()));
|
||||
ImmutableSetMultimap<String, Role> roleMap = registrarAccessor.getAllClientIdWithRoles();
|
||||
data.put("allClientIds", roleMap.keySet());
|
||||
data.put("environment", environment.toString());
|
||||
// We set the initual value to the value that will show if guessClientId throws.
|
||||
String clientId = "<null>";
|
||||
try {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
{template .settings}
|
||||
{@param allowedTlds: list<string>}
|
||||
{@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')}">
|
||||
<h1>Administrator settings</h1>
|
||||
<table>
|
||||
|
@ -42,16 +43,20 @@
|
|||
class="{css('kd-button')} {css('btn-add')}">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<tr class="{css('kd-settings-pane-section')}">
|
||||
<td>
|
||||
<label class="{css('setting-label')}">OT&E setup page</label>
|
||||
<td class="{css('setting')}">
|
||||
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
||||
</p></td>
|
||||
</tr>
|
||||
{call .oteStatus}
|
||||
{param registrarType: $type /}
|
||||
{/call}
|
||||
{if $environment != 'PRODUCTION'}
|
||||
<tr class="{css('kd-settings-pane-section')}">
|
||||
<td>
|
||||
<label class="{css('setting-label')}">OT&E setup page</label>
|
||||
<td class="{css('setting')}">
|
||||
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
||||
</p></td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $type == 'OTE'}
|
||||
{call .oteStatus}
|
||||
{param registrarType: $type /}
|
||||
{/call}
|
||||
{/if}
|
||||
<tr class="{css('kd-settings-pane-section')}">
|
||||
<td>
|
||||
<label class="{css('setting-label')}">Create new registrar</label>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
{@param announcementsEmail: string}
|
||||
{@param supportPhoneNumber: string}
|
||||
{@param technicalDocsUrl: string}
|
||||
{@param environment: string}
|
||||
|
||||
{call registry.soy.console.header}
|
||||
{param app: 'registrar' /}
|
||||
|
@ -82,7 +83,8 @@
|
|||
{$supportEmail},
|
||||
{$announcementsEmail},
|
||||
{$supportPhoneNumber},
|
||||
{$technicalDocsUrl});
|
||||
{$technicalDocsUrl},
|
||||
{$environment});
|
||||
</script>
|
||||
{/if}
|
||||
{/template}
|
||||
|
|
|
@ -60,6 +60,7 @@ registry.registrar.ConsoleTestUtil.renderConsoleMain = function(
|
|||
announcementsEmail: args.announcementsEmail || 'announcement@example.com',
|
||||
supportPhoneNumber: args.supportPhoneNumber || '+1 (888) 555 0123',
|
||||
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.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
||||
|
@ -78,6 +79,7 @@ public class ConsoleUiActionTest {
|
|||
action.paramClientId = Optional.empty();
|
||||
AuthResult authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, false));
|
||||
action.authResult = authResult;
|
||||
action.environment = RegistryEnvironment.UNITTEST;
|
||||
|
||||
action.registrarAccessor =
|
||||
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