Skip to content

Commit

Permalink
[backend] fix migration (#7348)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Jun 12, 2024
1 parent 179c8b7 commit 3350f61
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export const up = async (next) => {
const platformMaxMarkingIdForType = platformMaxMarkingForType.id;
// case 1.1: if it is allowed, keep the platform max marking of this type
if (allowedMarkings.map((m) => m.id).includes(platformMaxMarkingIdForType)) {
const value = { type, value: platformMaxMarkingIdForType };
const value = [{ type, value: platformMaxMarkingIdForType }];
groupMaxMarkingRelationCreationsPromises.push(groupEditField(context, context.user, group.id, { key: 'max_shareable_markings', value }));
}
// case 1.2: if not allowed
// - keep the most restrictive allowed marking that has an order inferior to the platform max marking if it exists
// - not shareable if it doesnt exist
const sortedShareableMarkings = sortedAllowedMarkingsOfType.filter((m) => m.x_opencti_order <= platformMaxMarkingForType.x_opencti_order);
const markingId = sortedShareableMarkings.length > 0 ? sortedShareableMarkings[0].id : 'none';
const value = { type, value: markingId };
const value = [{ type, value: markingId }];
groupMaxMarkingRelationCreationsPromises.push(groupEditField(context, context.user, group.id, { key: 'max_shareable_markings', value }));
}
// case 2 : no marking defined for this type -> all the markings of this type should be shareable, so nothing to do
Expand Down

0 comments on commit 3350f61

Please sign in to comment.