open-vault/ui/app/serializers/identity/group.js

26 lines
627 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import DS from 'ember-data';
import IdentitySerializer from './_base';
2018-04-03 14:16:57 +00:00
export default IdentitySerializer.extend(DS.EmbeddedRecordsMixin, {
2018-04-03 14:16:57 +00:00
attrs: {
alias: { embedded: 'always' },
},
normalizeFindRecordResponse(store, primaryModelClass, payload) {
if (payload.alias && Object.keys(payload.alias).length === 0) {
delete payload.alias;
}
return this._super(...arguments);
},
serialize() {
let json = this._super(...arguments);
delete json.alias;
if (json.type === 'external') {
delete json.member_entity_ids;
delete json.member_group_ids;
}
return json;
},
});