2020-11-09 17:29:12 +00:00
|
|
|
import Model, { attr } from '@ember-data/model';
|
2020-09-01 18:13:11 +00:00
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { MANAGEMENT_ID } from 'consul-ui/models/policy';
|
2018-10-19 15:17:02 +00:00
|
|
|
|
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
|
|
export const SLUG_KEY = 'AccessorID';
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export default class Token extends Model {
|
|
|
|
@attr('string') uid;
|
|
|
|
@attr('string') AccessorID;
|
|
|
|
|
|
|
|
@attr('string') Datacenter;
|
|
|
|
@attr('string') Namespace;
|
2021-09-15 18:50:11 +00:00
|
|
|
@attr('string') Partition;
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string') IDPName;
|
|
|
|
@attr('string') SecretID;
|
|
|
|
|
|
|
|
@attr('boolean') Legacy;
|
|
|
|
@attr('boolean') Local;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Description;
|
|
|
|
@attr() meta; // {}
|
|
|
|
|
|
|
|
@attr({ defaultValue: () => [] }) Policies;
|
|
|
|
@attr({ defaultValue: () => [] }) Roles;
|
|
|
|
@attr({ defaultValue: () => [] }) ServiceIdentities;
|
|
|
|
@attr({ defaultValue: () => [] }) NodeIdentities;
|
|
|
|
@attr('date') CreateTime;
|
|
|
|
@attr('string') Hash;
|
|
|
|
@attr('number') CreateIndex;
|
|
|
|
@attr('number') ModifyIndex;
|
|
|
|
|
2018-10-19 15:17:02 +00:00
|
|
|
// Legacy
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string') Type;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Name;
|
|
|
|
@attr('string') Rules;
|
2018-10-19 15:17:02 +00:00
|
|
|
// End Legacy
|
2020-11-09 17:29:12 +00:00
|
|
|
|
|
|
|
@computed('Policies.[]')
|
|
|
|
get isGlobalManagement() {
|
2020-09-01 18:13:11 +00:00
|
|
|
return (this.Policies || []).find(item => item.ID === MANAGEMENT_ID);
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|
2021-07-30 17:52:37 +00:00
|
|
|
|
|
|
|
@computed('SecretID')
|
|
|
|
get hasSecretID() {
|
|
|
|
return this.SecretID !== '' && this.SecretID !== '<hidden>';
|
|
|
|
}
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|