open-nomad/ui/app/abilities/allocation.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
539 B
JavaScript
Raw Normal View History

import AbstractAbility from './abstract';
import { computed, get } from '@ember/object';
import { or } from '@ember/object/computed';
export default class Allocation extends AbstractAbility {
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportExec')
canExec;
@computed('rulesForNamespace.@each.capabilities')
get policiesSupportExec() {
2021-12-28 14:45:20 +00:00
return this.rulesForNamespace.some((rules) => {
let capabilities = get(rules, 'Capabilities') || [];
return capabilities.includes('alloc-exec');
});
}
}