feat: 🎸 Update credential model with ssh private key attributes (#1254)
✅ Closes: ICU-5645
This commit is contained in:
1 parent
29e3e8b843
commit
39c0835a99
3 files changed
+25
-6
No files matched your search
@@ -46,6 +46,14 @@ export default class GeneratedCredentialModel extends BaseModel {
|
||||
})
|
||||
version;
|
||||
|
||||
// =attributes (username_password, ssh_private_key)
|
||||
@attr('string', {
|
||||
for: ['username_password', 'ssh_private_key'],
|
||||
isNestedAttribute: true,
|
||||
description: 'The username for credential.',
|
||||
})
|
||||
username;
|
||||
|
||||
// =attributes (username_password)
|
||||
@attr('string', {
|
||||
for: 'username_password',
|
||||
@@ -54,10 +62,18 @@ export default class GeneratedCredentialModel extends BaseModel {
|
||||
})
|
||||
password;
|
||||
|
||||
// =attributes (ssh_private_key)
|
||||
@attr('string', {
|
||||
for: 'username_password',
|
||||
for: 'ssh_private_key',
|
||||
isNestedAttribute: true,
|
||||
description: 'The username for credential.',
|
||||
description: 'The private key for credential.',
|
||||
})
|
||||
username;
|
||||
private_key;
|
||||
|
||||
@attr('string', {
|
||||
for: 'ssh_private_key',
|
||||
isNestedAttribute: true,
|
||||
description: 'The passphrase for credential.',
|
||||
})
|
||||
passphrase;
|
||||
}
|
||||
@@ -5,6 +5,10 @@ export default class CredentialSerializer extends ApplicationSerializer {
|
||||
serialize() {
|
||||
const serialized = super.serialize(...arguments);
|
||||
delete serialized['attributes']['password_hmac'];
|
||||
if (serialized.type === 'username_password') {
|
||||
delete serialized['attributes']['private_key'];
|
||||
delete serialized['attributes']['passphrase'];
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@ import { setupTest } from 'ember-qunit';
|
||||
module('Unit | Model | credential', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('credential', {});
|
||||
const store = this.owner.lookup('service:store');
|
||||
const model = store.createRecord('credential', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user