2022-06-30 18:30:50 +08:00
|
|
|
<LinkTo @route="adminApiKeys.index" class="go-back">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{d-icon "arrow-left"}}
|
2021-09-27 16:43:47 +08:00
|
|
|
<span>{{i18n "admin.api.all_api_keys"}}</span>
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2020-09-11 21:38:28 +08:00
|
|
|
<div class="api-key api-key-new">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.id}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.key">
|
2022-07-06 01:41:31 +08:00
|
|
|
<div>{{this.model.key}}</div>
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
|
|
|
<AdminFormRow>
|
2019-12-12 19:45:00 +08:00
|
|
|
{{i18n "admin.api.not_shown_again"}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
|
|
|
<AdminFormRow>
|
|
|
|
<DButton
|
|
|
|
@icon="angle-right"
|
|
|
|
@label="admin.api.continue"
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{this.continue}}
|
|
|
|
class="btn-primary"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
|
|
|
</AdminFormRow>
|
2019-12-12 19:45:00 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.description">
|
2022-07-06 16:37:54 +08:00
|
|
|
<Input
|
|
|
|
@value={{this.model.description}}
|
|
|
|
maxlength="255"
|
|
|
|
placeholder={{i18n "admin.api.description_placeholder"}}
|
|
|
|
/>
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.user_mode">
|
2022-07-06 01:41:31 +08:00
|
|
|
<ComboBox
|
|
|
|
@content={{this.userModes}}
|
|
|
|
@value={{this.userMode}}
|
|
|
|
@onChange={{action "changeUserMode"}}
|
|
|
|
/>
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.showUserSelector}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.user">
|
2022-07-06 01:41:31 +08:00
|
|
|
<EmailGroupUserChooser
|
|
|
|
@value={{this.model.username}}
|
|
|
|
@onChange={{action "updateUsername"}}
|
|
|
|
@options={{hash
|
2021-02-01 18:07:11 +08:00
|
|
|
maximum=1
|
|
|
|
filterPlaceholder="admin.api.user_placeholder"
|
2022-06-30 18:30:50 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</AdminFormRow>
|
2019-12-12 19:45:00 +08:00
|
|
|
{{/if}}
|
2020-07-17 02:51:24 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.scope_mode">
|
2022-07-06 01:41:31 +08:00
|
|
|
<ComboBox
|
|
|
|
@content={{this.scopeModes}}
|
|
|
|
@value={{this.scopeMode}}
|
|
|
|
@onChange={{action "changeScopeMode"}}
|
|
|
|
/>
|
2021-11-10 23:48:00 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if (eq this.scopeMode "read_only")}}
|
2021-11-10 23:48:00 +08:00
|
|
|
<p>{{i18n "admin.api.scopes.descriptions.global.read"}}</p>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{else if (eq this.scopeMode "global")}}
|
2021-11-10 23:48:00 +08:00
|
|
|
<p>{{i18n "admin.api.scopes.global_description"}}</p>
|
|
|
|
{{/if}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2020-07-17 02:51:24 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if (eq this.scopeMode "granular")}}
|
2021-11-10 23:48:00 +08:00
|
|
|
<h2 class="scopes-title">{{i18n "admin.api.scopes.title"}}</h2>
|
2020-08-19 02:12:04 +08:00
|
|
|
<p>{{i18n "admin.api.scopes.description"}}</p>
|
2020-09-11 21:38:28 +08:00
|
|
|
<table class="scopes-table grid">
|
2020-08-24 23:15:08 +08:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td>{{i18n "admin.api.scopes.allowed_urls"}}</td>
|
|
|
|
<td>{{i18n "admin.api.scopes.optional_allowed_parameters"}}</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each-in this.scopes as |resource actions|}}
|
2020-09-11 21:38:28 +08:00
|
|
|
<tr class="scope-resource-name">
|
|
|
|
<td><b>{{resource}}</b></td>
|
2020-08-24 23:15:08 +08:00
|
|
|
<td></td>
|
|
|
|
<td></td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
{{#each actions as |act|}}
|
|
|
|
<tr>
|
2022-06-30 18:30:50 +08:00
|
|
|
<td><Input @type="checkbox" @checked={{act.selected}} /></td>
|
2020-08-19 02:12:04 +08:00
|
|
|
<td>
|
|
|
|
<div class="scope-name">{{act.name}}</div>
|
2023-10-24 03:09:02 +08:00
|
|
|
<DTooltip
|
|
|
|
@icon="question-circle"
|
|
|
|
@content={{i18n
|
2020-08-19 02:12:04 +08:00
|
|
|
(concat
|
|
|
|
"admin.api.scopes.descriptions." resource "." act.key
|
2022-12-28 20:28:11 +08:00
|
|
|
)
|
2023-10-24 03:09:02 +08:00
|
|
|
class="scope-tooltip"
|
2020-08-19 02:12:04 +08:00
|
|
|
}}
|
2023-10-24 03:09:02 +08:00
|
|
|
/>
|
2020-08-19 02:12:04 +08:00
|
|
|
</td>
|
|
|
|
<td>
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@icon="link"
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.showURLs act.urls}}
|
|
|
|
class="btn-info"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
2020-08-19 02:12:04 +08:00
|
|
|
</td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td>
|
|
|
|
{{#each act.params as |p|}}
|
2022-07-06 16:37:54 +08:00
|
|
|
<Input
|
|
|
|
maxlength="255"
|
|
|
|
@value={{get act p}}
|
|
|
|
placeholder={{p}}
|
|
|
|
/>
|
2020-07-17 02:51:24 +08:00
|
|
|
{{/each}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/each}}
|
2020-08-24 23:15:08 +08:00
|
|
|
{{/each-in}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-11-10 23:48:00 +08:00
|
|
|
{{/if}}
|
2020-07-17 02:51:24 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
<DButton
|
|
|
|
@icon="check"
|
|
|
|
@label="admin.api.save"
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{this.save}}
|
2022-07-06 01:41:31 +08:00
|
|
|
@disabled={{this.saveDisabled}}
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-primary"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
2020-02-03 21:22:14 +08:00
|
|
|
</div>
|