2019-11-05 22:10:23 +08:00
|
|
|
{{#link-to "adminApiKeys.index" class="go-back"}}
|
|
|
|
{{d-icon "arrow-left"}}
|
|
|
|
{{i18n "admin.api.all_api_keys"}}
|
|
|
|
{{/link-to}}
|
|
|
|
|
|
|
|
<div class="api-key">
|
|
|
|
{{#admin-form-row label="admin.api.key"}}
|
|
|
|
{{#if model.revoked_at}}{{d-icon "times-circle"}}{{/if}}
|
2019-12-12 19:45:00 +08:00
|
|
|
{{model.truncatedKey}}
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.description"}}
|
|
|
|
{{#if editingDescription}}
|
|
|
|
{{input value=buffered.description maxlength="255" placeholder=(i18n "admin.api.description_placeholder")}}
|
|
|
|
{{else}}
|
2020-02-11 22:55:16 +08:00
|
|
|
<span>
|
|
|
|
{{if model.description model.description (i18n "admin.api.no_description")}}
|
|
|
|
</span>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div class="controls">
|
|
|
|
{{#if editingDescription}}
|
|
|
|
{{d-button class="ok" action=(action "saveDescription") icon="check"}}
|
|
|
|
{{d-button class="cancel" action=(action "editDescription") icon="times"}}
|
|
|
|
{{else}}
|
|
|
|
{{d-button class="btn-default" action=(action "editDescription") icon="pencil-alt"}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.user"}}
|
|
|
|
{{#if model.user}}
|
|
|
|
{{#link-to "adminUser" model.user}}
|
|
|
|
{{avatar model.user imageSize="small"}} {{model.user.username}}
|
|
|
|
{{/link-to}}
|
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.all_users"}}
|
|
|
|
{{/if}}
|
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.created"}}
|
|
|
|
{{format-date model.created_at leaveAgo="true"}}
|
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.updated"}}
|
|
|
|
{{format-date model.updated_at leaveAgo="true"}}
|
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.last_used"}}
|
2019-11-08 07:41:43 +08:00
|
|
|
{{#if model.last_used_at}}
|
|
|
|
{{format-date model.last_used_at leaveAgo="true"}}
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.never_used"}}
|
|
|
|
{{/if}}
|
|
|
|
{{/admin-form-row}}
|
|
|
|
|
|
|
|
{{#admin-form-row label="admin.api.revoked"}}
|
|
|
|
{{#if model.revoked_at}}
|
|
|
|
{{format-date model.revoked_at leaveAgo="true"}}
|
|
|
|
{{/if}}
|
|
|
|
<div class="controls">
|
|
|
|
{{#if model.revoked_at}}
|
|
|
|
{{d-button
|
|
|
|
action=(action "undoRevokeKey")
|
|
|
|
actionParam=model icon="undo"
|
|
|
|
label="admin.api.undo_revoke"}}
|
|
|
|
{{d-button
|
|
|
|
action=(action "deleteKey")
|
2020-01-07 01:35:00 +08:00
|
|
|
actionParam=model icon="trash-alt"
|
2019-11-05 22:10:23 +08:00
|
|
|
label="admin.api.delete"
|
|
|
|
class="btn-danger"}}
|
|
|
|
{{else}}
|
|
|
|
{{d-button
|
|
|
|
class="btn-danger"
|
|
|
|
action=(action "revokeKey")
|
|
|
|
actionParam=model
|
|
|
|
icon="times"
|
|
|
|
label="admin.api.revoke"}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/admin-form-row}}
|
2020-07-17 02:51:24 +08:00
|
|
|
|
|
|
|
{{#if model.api_key_scopes.length}}
|
2020-08-19 02:12:04 +08:00
|
|
|
<div class="scopes-title">{{i18n "admin.api.scopes.title"}}</div>
|
2020-07-17 02:51:24 +08:00
|
|
|
|
|
|
|
<table class="scopes-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td>{{i18n "admin.api.scopes.resource"}}</td>
|
|
|
|
<td>{{i18n "admin.api.scopes.action"}}</td>
|
2020-08-19 02:12:04 +08:00
|
|
|
<td>{{i18n "admin.api.scopes.allowed_urls"}}</td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td>{{i18n "admin.api.scopes.allowed_parameters"}}</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{#each model.api_key_scopes as |scope|}}
|
|
|
|
<tr>
|
|
|
|
<td>{{scope.resource}}</td>
|
2020-08-19 02:12:04 +08:00
|
|
|
<td>
|
|
|
|
{{scope.action}}
|
|
|
|
<span
|
|
|
|
class="scope-tooltip"
|
|
|
|
data-tooltip={{i18n (concat "admin.api.scopes.descriptions." scope.resource "." scope.key)}}>
|
|
|
|
{{d-icon "question-circle"}}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{d-button icon="link" action=(action "showURLs" scope.urls) class="btn-info"}}
|
|
|
|
</td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td>
|
|
|
|
{{#each scope.parameters as |p|}}
|
|
|
|
<div>
|
|
|
|
<b>{{p}}:</b>
|
|
|
|
{{#if (get scope.allowed_parameters p)}}
|
|
|
|
{{get scope.allowed_parameters p}}
|
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.scopes.any_parameter"}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/each}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{{/if}}
|
2020-01-07 01:35:00 +08:00
|
|
|
</div>
|