mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
This rethinks namespaces as a filter on list pages rather than a global setting. The biggest net-new feature here is being able to select All (*) to list all jobs or CSI volumes across namespaces.
33 lines
991 B
JavaScript
33 lines
991 B
JavaScript
import AbstractAbility from './abstract';
|
|
import { computed } from '@ember/object';
|
|
import { or } from '@ember/object/computed';
|
|
|
|
export default class Job extends AbstractAbility {
|
|
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportRunning')
|
|
canRun;
|
|
|
|
@or(
|
|
'bypassAuthorization',
|
|
'selfTokenIsManagement',
|
|
'policiesSupportRunning',
|
|
'policiesSupportScaling'
|
|
)
|
|
canScale;
|
|
|
|
// TODO: A person can also see all jobs if their token grants read access to all namespaces,
|
|
// but given the complexity of namespaces and policy precedence, there isn't a good quick way
|
|
// to confirm this.
|
|
@or('bypassAuthorization', 'selfTokenIsManagement')
|
|
canListAll;
|
|
|
|
@computed('rulesForNamespace.@each.capabilities')
|
|
get policiesSupportRunning() {
|
|
return this.namespaceIncludesCapability('submit-job');
|
|
}
|
|
|
|
@computed('rulesForNamespace.@each.capabilities')
|
|
get policiesSupportScaling() {
|
|
return this.namespaceIncludesCapability('scale-job');
|
|
}
|
|
}
|