2020-05-11 19:43:17 +00:00
|
|
|
import AbstractAbility from './abstract';
|
|
|
|
import { computed, get } from '@ember/object';
|
|
|
|
import { or } from '@ember/object/computed';
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class Allocation extends AbstractAbility {
|
|
|
|
@or('bypassAuthorization', 'selfTokenIsManagement', 'policiesSupportExec')
|
|
|
|
canExec;
|
2020-05-11 19:43:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('rulesForActiveNamespace.@each.capabilities')
|
|
|
|
get policiesSupportExec() {
|
2020-05-11 19:43:17 +00:00
|
|
|
return this.rulesForActiveNamespace.some(rules => {
|
|
|
|
let capabilities = get(rules, 'Capabilities') || [];
|
|
|
|
return capabilities.includes('alloc-exec');
|
|
|
|
});
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|