diff --git a/opencti-platform/opencti-graphql/src/database/stix.ts b/opencti-platform/opencti-graphql/src/database/stix.ts index 629850f505978..294251820b0e9 100644 --- a/opencti-platform/opencti-graphql/src/database/stix.ts +++ b/opencti-platform/opencti-graphql/src/database/stix.ts @@ -1177,20 +1177,15 @@ export const isRelationBuiltin = (instance: StoreRelation): boolean => { }; export const checkRelationshipRef = (fromType: string, toType: string, relationshipType: string) => { - logApp.info(`ANGIE checkRelationshipRef - from:${fromType}, to:${toType}, relationshipType:${relationshipType}`); const relationRefs = schemaRelationsRefDefinition.getRelationsRef(fromType).filter((rel) => { - logApp.info(`ANGIE checkRelationshipRef - ${rel.databaseName} ?? ${relationshipType}`); return rel.databaseName === relationshipType; }); - logApp.info(`ANGIE checkRelationshipRef - relationRefs.length:${relationRefs.length}`); if (relationRefs.length === 0) { throw FunctionalError('The relationship is not allowed', { type: relationshipType, from: fromType, to: toType }); } if (relationRefs.length > 1) { throw FunctionalError('Invalid relationship schema', { type: relationshipType, from: fromType, to: toType, data: relationRefs }); } - - logApp.info(`ANGIE relationRefs[0]=${relationRefs[0].toTypes}`); if (!relationRefs[0].isRefExistingForTypes(fromType, toType)) { throw FunctionalError('The relationship is not allowed', { type: relationshipType, from: fromType, to: toType }); } diff --git a/opencti-platform/opencti-graphql/src/manager/taskManager.js b/opencti-platform/opencti-graphql/src/manager/taskManager.js index 7d928d07494fd..cce7a3a05dec0 100644 --- a/opencti-platform/opencti-graphql/src/manager/taskManager.js +++ b/opencti-platform/opencti-graphql/src/manager/taskManager.js @@ -402,7 +402,6 @@ const executeRuleElementRescan = async (context, user, actionContext, element) = } }; export const executeShare = async (context, user, actionContext, element) => { - logApp.info('ANGIE executeShare', { actionContext, element }); const { values } = actionContext; for (let indexCreate = 0; indexCreate < values.length; indexCreate += 1) { const target = values[indexCreate]; @@ -550,7 +549,7 @@ const executeProcessing = async (context, user, job, scope) => { return errors; }; -const taskHandler = async () => { +export const taskHandler = async () => { let lock; try { // Lock the manager diff --git a/opencti-platform/opencti-graphql/src/schema/stixRefRelationship.ts b/opencti-platform/opencti-graphql/src/schema/stixRefRelationship.ts index 02db08f1d835c..78cc626bc1227 100644 --- a/opencti-platform/opencti-graphql/src/schema/stixRefRelationship.ts +++ b/opencti-platform/opencti-graphql/src/schema/stixRefRelationship.ts @@ -728,14 +728,14 @@ export const objectOrganization: RefAttribute = { multiple: true, upsert: true, isRefExistingForTypes(this, fromType, toType) { - logApp.info(`ANGIE isRefExistingForTypes this.type:${this.type}, fromType:${fromType}, toType:${toType} `); + // TODO understand the impact of this return !(fromType === ENTITY_TYPE_EVENT /* || isStixDomainObjectIdentity(fromType) */ || isStixDomainObjectLocation(fromType)) && this.toTypes.includes(toType); }, datable: false, isFilterable: true, - toTypes: [ENTITY_TYPE_IDENTITY_ORGANIZATION], // ANGIE + toTypes: [ENTITY_TYPE_IDENTITY_ORGANIZATION], }; export const objectAssignee: RefAttribute = { diff --git a/opencti-platform/opencti-graphql/tests/02-integration/02-resolvers/container-organization-sharing-test.ts b/opencti-platform/opencti-graphql/tests/02-integration/02-resolvers/container-organization-sharing-test.ts index 868417b926e21..81daa73cb4245 100644 --- a/opencti-platform/opencti-graphql/tests/02-integration/02-resolvers/container-organization-sharing-test.ts +++ b/opencti-platform/opencti-graphql/tests/02-integration/02-resolvers/container-organization-sharing-test.ts @@ -16,7 +16,7 @@ import { import { adminQueryWithSuccess, queryAsUserWithSuccess } from '../../utils/testQueryHelper'; import { findById } from '../../../src/domain/report'; import { execChildPython } from '../../../src/python/pythonBridge'; -import { wait } from '../../../src/database/utils'; +import { taskHandler } from '../../../src/manager/taskManager'; const READ_QUERY = gql` query caseIncident($id: String!) { @@ -141,8 +141,8 @@ describe('Organization sharing standard behavior for container', () => { expect(organizationSharingQueryResult?.data?.stixCoreObjectEdit.restrictionOrganizationAdd).not.toBeNull(); expect(organizationSharingQueryResult?.data?.stixCoreObjectEdit.restrictionOrganizationAdd.objectOrganization[0].name).toEqual(TEST_ORGANIZATION.name); - // Wait for background task magic to happens - await wait(5000); + // Need background task magic to happens for sharing + await taskHandler(); }); it('should Editor user access all objects', async () => { const REPORT_STIX_DOMAIN_ENTITIES = gql`