From 8bc064ad678c2559b3b25be9d3ebe08f74b6dcfc Mon Sep 17 00:00:00 2001 From: marie flores Date: Thu, 12 Dec 2024 15:59:46 +0100 Subject: [PATCH] [backend] use constants --- opencti-platform/opencti-graphql/src/database/utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opencti-platform/opencti-graphql/src/database/utils.js b/opencti-platform/opencti-graphql/src/database/utils.js index 279ed32521bf..78262b2caf14 100644 --- a/opencti-platform/opencti-graphql/src/database/utils.js +++ b/opencti-platform/opencti-graphql/src/database/utils.js @@ -11,9 +11,10 @@ import { isStixCoreRelationship } from '../schema/stixCoreRelationship'; import { isStixSightingRelationship } from '../schema/stixSightingRelationship'; import conf from '../config/conf'; import { now } from '../utils/format'; -import { isStixRefRelationship } from '../schema/stixRefRelationship'; +import { isStixRefRelationship, RELATION_OBJECT_MARKING } from '../schema/stixRefRelationship'; import { schemaAttributesDefinition } from '../schema/schema-attributes'; import { getDraftContext } from '../utils/draftContext'; +import { INPUT_OBJECTS } from '../schema/general'; export const ES_INDEX_PREFIX = conf.get('elasticsearch:index_prefix') || 'opencti'; const rabbitmqPrefix = conf.get('rabbitmq:queue_prefix'); @@ -329,8 +330,8 @@ export const extractIdsFromStoreObject = (instance) => { export const extractObjectsRestrictionsFromInputs = (inputs) => { const markings = []; inputs.forEach((input) => { - if (input && input.key === 'objects' && input.value?.length > 0) { - const objectMarking = input.value.flatMap((value) => value['object-marking'] ?? []); + if (input && input.key === INPUT_OBJECTS && input.value?.length > 0) { + const objectMarking = input.value.flatMap((value) => value[RELATION_OBJECT_MARKING] ?? []); markings.push(...objectMarking); } });