chore: 🤖 add abilities for injected app cred sources (#1285)
* chore: 🤖 add abilities for injected app cred sources
This commit is contained in:
1 parent
a3337b3771
commit
069a864cbb
4 files changed
+31
-7
No files matched your search
@@ -37,7 +37,15 @@ export default class TargetAbility extends ModelAbility {
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
get canRemoveBrokeredCredentialSources() {
|
||||
get canAddInjectedApplicationCredentialSources() {
|
||||
return (
|
||||
this.model.isSSH && this.hasAuthorizedAction('add-credential-sources')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
get canRemoveCredentialSources() {
|
||||
return this.hasAuthorizedAction('remove-credential-sources');
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { attr } from '@ember-data/model';
|
||||
export default class WorkerModel extends GeneratedWorkerModel {
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
/**
|
||||
* Names are optional on models in our API. Thus we need to fallback on ID
|
||||
* for display purposes.
|
||||
* @type {string}
|
||||
|
||||
@@ -37,7 +37,7 @@ module('Unit | Abilities | Target', function (hooks) {
|
||||
assert.notOk(service.can('removeHostSources target', model));
|
||||
});
|
||||
|
||||
test('it reflects when a given target may add credential sources', function (assert) {
|
||||
test('it reflects when a given target may add brokered credential sources', function (assert) {
|
||||
assert.expect(2);
|
||||
const service = this.owner.lookup('service:can');
|
||||
const model = {
|
||||
@@ -48,14 +48,30 @@ module('Unit | Abilities | Target', function (hooks) {
|
||||
assert.notOk(service.can('addBrokeredCredentialSources target', model));
|
||||
});
|
||||
|
||||
test('it reflects when a given target may remove crednetial sources', function (assert) {
|
||||
test('it reflects when a given target may remove credential sources', function (assert) {
|
||||
assert.expect(2);
|
||||
const service = this.owner.lookup('service:can');
|
||||
const model = {
|
||||
authorized_actions: ['remove-credential-sources'],
|
||||
};
|
||||
assert.ok(service.can('removeBrokeredCredentialSources target', model));
|
||||
assert.ok(service.can('removeCredentialSources target', model));
|
||||
model.authorized_actions = [];
|
||||
assert.notOk(service.can('removeBrokeredCredentialSources target', model));
|
||||
assert.notOk(service.can('removeCredentialSources target', model));
|
||||
});
|
||||
|
||||
test('it reflects when a given ssh target may add injected application credential sources', function (assert) {
|
||||
assert.expect(2);
|
||||
const service = this.owner.lookup('service:can');
|
||||
const model = {
|
||||
authorized_actions: ['add-credential-sources'],
|
||||
isSSH: true,
|
||||
};
|
||||
assert.ok(
|
||||
service.can('addInjectedApplicationCredentialSources target', model)
|
||||
);
|
||||
model.authorized_actions = [];
|
||||
assert.notOk(
|
||||
service.can('addInjectedApplicationCredentialSources target', model)
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -79,7 +79,7 @@
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
{{#if (can 'removeBrokeredCredentialSources target' @model)}}
|
||||
{{#if (can 'removeCredentialSources target' @model)}}
|
||||
<Rose::Dropdown
|
||||
@icon='flight-icons/svg/more-horizontal-16'
|
||||
@iconOnly={{true}}
|
||||
|
||||
Reference in new issue
Block a user