John Cowen 2547af7e1e
ui: Make peered intentions read-only (#13814)
* ui: Make peered intentions read-only

* Replace "" to undefined for SourcePeer so its the same as PeerName

* Fixup copypasta

* Ensure tests run with no peers
2022-07-26 17:29:37 +01:00

18 lines
495 B
JavaScript

import BaseAbility from './base';
export default class IntentionAbility extends BaseAbility {
resource = 'intention';
get canWrite() {
// Peered intentions aren't writable
if(typeof this.item !== 'undefined' && typeof this.item.SourcePeer !== 'undefined') {
return false;
}
return super.canWrite &&
(typeof this.item === 'undefined' || !this.canViewCRD);
}
get canViewCRD() {
return (typeof this.item !== 'undefined' && this.item.IsManagedByCRD);
}
}