d509588cd2
Ember update - update ember-cli, ember-data, and ember to 3.4 series
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
import { computed } from '@ember/object';
|
|
import { alias } from '@ember/object/computed';
|
|
import IdentityModel from './_base';
|
|
import DS from 'ember-data';
|
|
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
|
import identityCapabilities from 'vault/macros/identity-capabilities';
|
|
|
|
const { attr, hasMany } = DS;
|
|
|
|
export default IdentityModel.extend({
|
|
formFields: computed(function() {
|
|
return ['name', 'disabled', 'policies', 'metadata'];
|
|
}),
|
|
name: attr('string'),
|
|
disabled: attr('boolean', {
|
|
defaultValue: false,
|
|
label: 'Disable entity',
|
|
helpText: 'All associated tokens cannot be used, but are not revoked.',
|
|
}),
|
|
mergedEntityIds: attr(),
|
|
metadata: attr({
|
|
editType: 'kv',
|
|
}),
|
|
policies: attr({
|
|
editType: 'stringArray',
|
|
}),
|
|
creationTime: attr('string', {
|
|
readOnly: true,
|
|
}),
|
|
lastUpdateTime: attr('string', {
|
|
readOnly: true,
|
|
}),
|
|
aliases: hasMany('identity/entity-alias', { async: false, readOnly: true }),
|
|
groupIds: attr({
|
|
readOnly: true,
|
|
}),
|
|
directGroupIds: attr({
|
|
readOnly: true,
|
|
}),
|
|
inheritedGroupIds: attr({
|
|
readOnly: true,
|
|
}),
|
|
|
|
updatePath: identityCapabilities(),
|
|
canDelete: alias('updatePath.canDelete'),
|
|
canEdit: alias('updatePath.canUpdate'),
|
|
canRead: alias('updatePath.canRead'),
|
|
|
|
aliasPath: lazyCapabilities(apiPath`identity/entity-alias`),
|
|
canAddAlias: alias('aliasPath.canCreate'),
|
|
});
|