diff --git a/addon/components/api-key/tabs/overview.hbs b/addon/components/api-key/tabs/overview.hbs
index be6c57a..b35e81f 100644
--- a/addon/components/api-key/tabs/overview.hbs
+++ b/addon/components/api-key/tabs/overview.hbs
@@ -37,7 +37,7 @@
{{t "developers.api-keys.panel.secret"}}
{{t "developers.api-keys.panel.secret-hidden-prefix"}} {{t "developers.api-keys.panel.secret-roll-link"}} {{t "developers.api-keys.panel.secret-hidden-suffix"}}
{{t "developers.api-keys.drawer.scope"}}
-
+
{{t "developers.component.modals.api-key-form.allowed-browser-label"}}
{{#if this.origins.length}}
diff --git a/addon/components/modals/api-key-form.hbs b/addon/components/modals/api-key-form.hbs
index c4ee62c..9e35d0a 100644
--- a/addon/components/modals/api-key-form.hbs
+++ b/addon/components/modals/api-key-form.hbs
@@ -41,8 +41,8 @@
{{if options.isNew (t "developers.api-keys.form.expiration-help") (t "developers.api-keys.form.expiration-current" value=(or options.apiKey.expiresAt (t "developers.common.never")))}}
-
-
+
+
{{t "developers.api-keys.form.scope-help"}}
diff --git a/addon/models/api-credential.js b/addon/models/api-credential.js
index ca20df1..8a4347a 100644
--- a/addon/models/api-credential.js
+++ b/addon/models/api-credential.js
@@ -13,6 +13,7 @@ export default class ApiCredentialModel extends Model {
@attr('string') secret;
@attr('boolean', { defaultValue: false }) test_mode;
@attr('string') api;
+ @attr('string') profile;
@attr('raw') browser_origins;
/** @dates */
diff --git a/addon/services/api-key-actions.js b/addon/services/api-key-actions.js
index c6cc706..e12b667 100644
--- a/addon/services/api-key-actions.js
+++ b/addon/services/api-key-actions.js
@@ -49,6 +49,13 @@ export default class ApiKeyActionsService extends ResourceActionService {
/**
* The expiration options with translated labels for a Select.
*/
+ get scopeChoices() {
+ return [
+ { label: this.intl.t('developers.api-keys.drawer.full-access'), value: 'full' },
+ { label: this.intl.t('developers.api-keys.drawer.rider-access'), value: 'rider' },
+ ];
+ }
+
get expirationChoices() {
return this.expirationOptions.map((value) => ({ value, label: this.intl.t(`developers.api-keys.expiration.${value.replace(/\s+/g, '-')}`) }));
}
@@ -152,6 +159,10 @@ export default class ApiKeyActionsService extends ResourceActionService {
formPermission,
apiKey,
...this.originOptions(apiKey),
+ scopeChoices: this.scopeChoices,
+ setScope: (value) => {
+ apiKey.profile = value === 'full' ? null : value;
+ },
setExpiration: (value) => {
apiKey.expires_at = value || null;
},
@@ -225,6 +236,10 @@ export default class ApiKeyActionsService extends ResourceActionService {
formPermission,
apiKey,
...this.originOptions(apiKey),
+ scopeChoices: this.scopeChoices,
+ setScope: (value) => {
+ apiKey.profile = value === 'full' ? null : value;
+ },
setExpiration: (value) => {
apiKey.expires_at = value || null;
},
diff --git a/tests/unit/services/api-key-actions-test.js b/tests/unit/services/api-key-actions-test.js
index 2d46199..de0b85d 100644
--- a/tests/unit/services/api-key-actions-test.js
+++ b/tests/unit/services/api-key-actions-test.js
@@ -30,6 +30,15 @@ module('Unit | Service | api-key-actions', function (hooks) {
this.owner.register('service:host-router', EmptyServiceStub);
});
+ test('it offers full and rider access for a key', function (assert) {
+ const service = this.owner.lookup('service:api-key-actions');
+
+ assert.deepEqual(
+ service.scopeChoices.map((choice) => choice.value),
+ ['full', 'rider']
+ );
+ });
+
test('it keeps the shared dialog and transition API', function (assert) {
const service = this.owner.lookup('service:api-key-actions');
diff --git a/translations/en-us.yaml b/translations/en-us.yaml
index 1604689..d5b8550 100644
--- a/translations/en-us.yaml
+++ b/translations/en-us.yaml
@@ -256,7 +256,7 @@ developers:
name-placeholder: What will use this key, e.g. Production backend
environment-fixed: Cannot change after creation. Create a test key for the sandbox.
expiration-help: Never · 1 hour · 24 hours · 3 days · 7 days
- scope-help: Full access until scopes ship in v1.1
+ scope-help: Use rider access for a key inside a published rider app. It only reaches rider routes.
origins-placeholder: Add origin, e.g. https://app.example.com
environment-help: Follows the environment switch in the header.
environment-live: Live keys start with flb_live_ and read and write production data.
@@ -328,6 +328,7 @@ developers:
bars-label: Requests per hour over the last {days} days
scope: Scope
full-access: Full access
+ rider-access: Rider access
from: from
watch: Watch
channel: Channel