[Entanglement] Move composition check up
Move check for composition up higher in the sequence of if-blocks in the validation step of linking; remove fallback to [] for undefined composition, which is no longer necessary as a consequence of this. nasa/openmctweb#98
This commit is contained in:
@@ -45,14 +45,17 @@ define(
|
|||||||
if (parentCandidate.getId() === object.getId()) {
|
if (parentCandidate.getId() === object.getId()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((parentCandidate.getModel().composition || []).indexOf(object.getId()) !== -1) {
|
if (!parentCandidate.hasCapability('composition')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (parentCandidate.getModel().composition.indexOf(object.getId()) !== -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this.policyService.allow(
|
return this.policyService.allow(
|
||||||
"composition",
|
"composition",
|
||||||
parentCandidate.getCapability('type'),
|
parentCandidate.getCapability('type'),
|
||||||
object.getCapability('type')
|
object.getCapability('type')
|
||||||
) && parentCandidate.hasCapability('composition');
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
LinkService.prototype.perform = function (object, parentObject) {
|
LinkService.prototype.perform = function (object, parentObject) {
|
||||||
|
|||||||
Reference in New Issue
Block a user