fix: 🐛 Add missing mirage config urls for credentials (#1209)
This commit is contained in:
1 parent
27a676774c
commit
ae0ce2bfad
4 files changed
+17
-11
No files matched your search
@@ -47,13 +47,6 @@ export default class GeneratedCredentialModel extends BaseModel {
|
||||
version;
|
||||
|
||||
// =attributes (username_password)
|
||||
@attr('string', {
|
||||
for: 'username_password',
|
||||
isNestedAttribute: true,
|
||||
description: 'The password hmac for credential.',
|
||||
})
|
||||
password_hmac;
|
||||
|
||||
@attr('string', {
|
||||
for: 'username_password',
|
||||
isNestedAttribute: true,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { copy } from 'ember-copy';
|
||||
|
||||
export default class CredentialSerializer extends ApplicationSerializer {
|
||||
serialize() {
|
||||
let serialized = super.serialize(...arguments);
|
||||
const serialized = super.serialize(...arguments);
|
||||
delete serialized['attributes']['password_hmac'];
|
||||
return serialized;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,20 @@ export default function () {
|
||||
|
||||
// credentials
|
||||
|
||||
this.get(
|
||||
'/credentials',
|
||||
(
|
||||
{ credentials },
|
||||
{ queryParams: { credential_store_id: credentialStoreId } }
|
||||
) => credentials.where({ credentialStoreId })
|
||||
);
|
||||
this.get('/credentials/:id');
|
||||
this.post('/credentials', function ({ credentialStores, credentials }) {
|
||||
const attrs = this.normalizedRequestAttrs();
|
||||
const credentialStore = credentialStores.find(attrs.credentialStoreId);
|
||||
attrs.scopeId = credentialStore.scope.id;
|
||||
return credentials.create(attrs);
|
||||
});
|
||||
|
||||
// managed-groups
|
||||
this.get(
|
||||
|
||||
@@ -10,9 +10,9 @@ export default ApplicationSerializer.extend({
|
||||
);
|
||||
json.credential_store_id = model.credentialStoreId;
|
||||
|
||||
// in a real API, the following field is set-only and returned
|
||||
// as an associated HMAC field
|
||||
delete json.attributes?.password_hmac;
|
||||
// in a real API, the password field is not returned
|
||||
// so we delete it from the response
|
||||
delete json.attributes?.password;
|
||||
|
||||
return json;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user