2018-05-24 03:10:21 +00:00
|
|
|
import Ember from 'ember';
|
2018-04-03 14:16:57 +00:00
|
|
|
import IdentityModel from './_base';
|
|
|
|
import DS from 'ember-data';
|
2018-05-24 03:10:21 +00:00
|
|
|
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
|
|
|
import identityCapabilities from 'vault/macros/identity-capabilities';
|
|
|
|
|
|
|
|
const { computed } = Ember;
|
|
|
|
|
2018-04-03 14:16:57 +00:00
|
|
|
const { attr, hasMany } = DS;
|
|
|
|
|
|
|
|
export default IdentityModel.extend({
|
2018-05-24 03:10:21 +00:00
|
|
|
formFields: ['name', 'disabled', 'policies', 'metadata'],
|
2018-04-03 14:16:57 +00:00
|
|
|
name: attr('string'),
|
2018-05-24 03:10:21 +00:00
|
|
|
disabled: attr('boolean', {
|
|
|
|
defaultValue: false,
|
|
|
|
label: 'Disable entity',
|
|
|
|
helpText: 'All associated tokens cannot be used, but are not revoked.',
|
|
|
|
}),
|
2018-04-03 14:16:57 +00:00
|
|
|
mergedEntityIds: attr(),
|
2018-05-24 03:10:21 +00:00
|
|
|
metadata: attr({
|
2018-04-03 14:16:57 +00:00
|
|
|
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,
|
|
|
|
}),
|
2018-05-24 03:10:21 +00:00
|
|
|
|
|
|
|
updatePath: identityCapabilities(),
|
|
|
|
canDelete: computed.alias('updatePath.canDelete'),
|
|
|
|
canEdit: computed.alias('updatePath.canUpdate'),
|
2018-07-19 01:59:04 +00:00
|
|
|
canRead: computed.alias('updatePath.canRead'),
|
2018-05-24 03:10:21 +00:00
|
|
|
|
|
|
|
aliasPath: lazyCapabilities(apiPath`identity/entity-alias`),
|
|
|
|
canAddAlias: computed.alias('aliasPath.canCreate'),
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|