From 264e053dcb23fbc8b95a1908f8b1798fee4e7068 Mon Sep 17 00:00:00 2001 From: Jeremy Cloarec <159018898+JeremyCloarec@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:33:57 +0200 Subject: [PATCH] [backend] drafts bug fixes (#6577) --- .../src/private/components/settings/Policies.tsx | 1 - .../opencti-front/src/schema/relay.schema.graphql | 2 +- .../opencti-graphql/src/domain/attribute-utils.ts | 2 ++ opencti-platform/opencti-graphql/src/http/httpServer.js | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/opencti-platform/opencti-front/src/private/components/settings/Policies.tsx b/opencti-platform/opencti-front/src/private/components/settings/Policies.tsx index 114cbd88cf5d..fe1e8b101574 100644 --- a/opencti-platform/opencti-front/src/private/components/settings/Policies.tsx +++ b/opencti-platform/opencti-front/src/private/components/settings/Policies.tsx @@ -38,7 +38,6 @@ import useEnterpriseEdition from '../../../utils/hooks/useEnterpriseEdition'; import ItemBoolean from '../../../components/ItemBoolean'; import Breadcrumbs from '../../../components/Breadcrumbs'; import useApiMutation from '../../../utils/hooks/useApiMutation'; -import type { Theme } from '../../../components/Theme'; import useSensitiveModifications from '../../../utils/hooks/useSensitiveModifications'; import Transition from '../../../components/Transition'; import type { Theme } from '../../../components/Theme'; diff --git a/opencti-platform/opencti-front/src/schema/relay.schema.graphql b/opencti-platform/opencti-front/src/schema/relay.schema.graphql index 477ee262e864..fab2c065c908 100644 --- a/opencti-platform/opencti-front/src/schema/relay.schema.graphql +++ b/opencti-platform/opencti-front/src/schema/relay.schema.graphql @@ -1608,8 +1608,8 @@ type MeUser implements BasicObject & InternalObject { submenu_show_icons: Boolean submenu_auto_collapse: Boolean monochrome_labels: Boolean - draft_context: String can_manage_sensitive_config: Boolean + draft_context: String } type SessionDetail { diff --git a/opencti-platform/opencti-graphql/src/domain/attribute-utils.ts b/opencti-platform/opencti-graphql/src/domain/attribute-utils.ts index 435c95414e53..5f7c36c31bca 100644 --- a/opencti-platform/opencti-graphql/src/domain/attribute-utils.ts +++ b/opencti-platform/opencti-graphql/src/domain/attribute-utils.ts @@ -3,6 +3,7 @@ import { baseType, createdAt, creators, + draftIds, entityLocationType, entityType, files, @@ -27,6 +28,7 @@ export const INTERNAL_ATTRIBUTES = [ id.name, internalId.name, standardId.name, + draftIds.name, xOpenctiStixIds.name, iAliasedIds.name, // Auditing diff --git a/opencti-platform/opencti-graphql/src/http/httpServer.js b/opencti-platform/opencti-graphql/src/http/httpServer.js index 803b6f9a32c0..f90dd18eefa5 100644 --- a/opencti-platform/opencti-graphql/src/http/httpServer.js +++ b/opencti-platform/opencti-graphql/src/http/httpServer.js @@ -124,10 +124,10 @@ const createHttpServer = async () => { executeContext.synchronizedUpsert = req.headers['synchronized-upsert'] === 'true'; // If full sync needs to be done try { const user = await authenticateUserFromRequest(executeContext, req, res); - if (isFeatureEnabled('DRAFT_WORKSPACE') && !executeContext.draft_context) { - executeContext.draft_context = user.draft_context; - } if (user) { + if (isFeatureEnabled('DRAFT_WORKSPACE') && !executeContext.draft_context) { + executeContext.draft_context = user.draft_context; + } executeContext.user = userWithOrigin(req, user); } } catch (error) {