■ ■ ■ ■ ■ ■
opencti-platform/opencti-graphql/src/database/middleware.js
| skipped 2320 lines |
2321 | 2321 | | patchInputs.push({ key: inputField, value: instancesToCreate, operation: UPDATE_OPERATION_ADD }); |
2322 | 2322 | | createdTargets.push({ key: inputField, instances: instancesToCreate }); |
2323 | 2323 | | } |
2324 | | - | // Handle full synchronization only for granted refs |
2325 | | - | if (inputField === INPUT_GRANTED_REFS) { |
| 2324 | + | // Handle full synchronization for granted refs if specified |
| 2325 | + | if (inputField === INPUT_GRANTED_REFS && updatePatch[inputField]) { |
2326 | 2326 | | const instancesToRemove = existingInstances.filter((m) => !patchInputData.map((u) => u.internal_id).includes(m)); |
2327 | 2327 | | if (instancesToRemove.length > 0) { |
2328 | 2328 | | const currentRels = await listAllRelations(context, user, relType, { |
| skipped 27 lines |
2356 | 2356 | | patchInputs.push({ key: inputField, value: instancesToCreate, operation: UPDATE_OPERATION_ADD }); |
2357 | 2357 | | createdTargets.push({ key: inputField, instances: instancesToCreate }); |
2358 | 2358 | | } |
2359 | | - | // Handle full synchronization only for granted refs |
2360 | | - | if (inputField === INPUT_GRANTED_REFS) { |
| 2359 | + | // Handle full synchronization for granted refs if specified |
| 2360 | + | if (inputField === INPUT_GRANTED_REFS && updatePatch[inputField]) { |
2361 | 2361 | | const instancesToRemove = existingInstances.filter((m) => !patchInputData.map((u) => u.internal_id).includes(m)); |
2362 | 2362 | | if (instancesToRemove.length > 0) { |
2363 | 2363 | | const currentRels = await listAllRelations(context, user, relType, { |
| skipped 885 lines |