2020-05-11 19:43:17 +00:00
|
|
|
import AbstractAbility from './abstract';
|
2020-06-18 05:44:35 +00:00
|
|
|
import { computed } from '@ember/object';
|
2020-05-11 19:43:17 +00:00
|
|
|
import { or } from '@ember/object/computed';
|
2020-01-20 20:57:01 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class Job extends AbstractAbility {
|
|
|
|
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportRunning')
|
|
|
|
canRun;
|
2020-01-20 20:57:01 +00:00
|
|
|
|
2020-06-18 05:44:35 +00:00
|
|
|
@or(
|
|
|
|
'bypassAuthorization',
|
|
|
|
'selfTokenIsManagement',
|
|
|
|
'policiesSupportRunning',
|
|
|
|
'policiesSupportScaling'
|
|
|
|
)
|
|
|
|
canScale;
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('rulesForActiveNamespace.@each.capabilities')
|
|
|
|
get policiesSupportRunning() {
|
2020-06-18 05:44:35 +00:00
|
|
|
return this.activeNamespaceIncludesCapability('submit-job');
|
|
|
|
}
|
|
|
|
|
|
|
|
@computed('rulesForActiveNamespace.@each.capabilities')
|
|
|
|
get policiesSupportScaling() {
|
|
|
|
return this.activeNamespaceIncludesCapability('scale-job');
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|