mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-24 08:01:07 +02:00
23 lines
565 B
JavaScript
23 lines
565 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ApplicationSerializer from '../application';
|
|
|
|
export default class LdapRoleSerializer extends ApplicationSerializer {
|
|
primaryKey = 'name';
|
|
|
|
serialize(snapshot) {
|
|
// remove all fields that are not relevant to specified role type
|
|
const { fieldsForType } = snapshot.record;
|
|
const json = super.serialize(...arguments);
|
|
Object.keys(json).forEach((key) => {
|
|
if (!fieldsForType.includes(key)) {
|
|
delete json[key];
|
|
}
|
|
});
|
|
return json;
|
|
}
|
|
}
|