From 112c4f510acdcf761b473fdd1ceac91f11b8f46b Mon Sep 17 00:00:00 2001 From: marie flores Date: Thu, 16 Jan 2025 17:13:13 +0100 Subject: [PATCH] [backend] Remove allowed_organizations from User --- opencti-platform/opencti-graphql/src/domain/user.js | 2 -- opencti-platform/opencti-graphql/src/types/user.d.ts | 1 - opencti-platform/opencti-graphql/src/utils/access.ts | 8 -------- .../tests/02-integration/01-database/file-storage-test.js | 1 - .../02-integration/04-manager/notificationManager-test.js | 1 - opencti-platform/opencti-graphql/tests/utils/testQuery.ts | 2 -- 6 files changed, 15 deletions(-) diff --git a/opencti-platform/opencti-graphql/src/domain/user.js b/opencti-platform/opencti-graphql/src/domain/user.js index 8cb93602d2d3..9b65785dcb02 100644 --- a/opencti-platform/opencti-graphql/src/domain/user.js +++ b/opencti-platform/opencti-graphql/src/domain/user.js @@ -1260,7 +1260,6 @@ const buildSessionUser = (origin, impersonate, provider, settings) => { default_hidden_types: user.default_hidden_types, group_ids: user.groups?.map((g) => g.internal_id) ?? [], organizations: user.organizations ?? [], - allowed_organizations: user.allowed_organizations, administrated_organizations: user.administrated_organizations ?? [], inside_platform_organization: user.inside_platform_organization, allowed_marking: user.allowed_marking.map((m) => ({ @@ -1386,7 +1385,6 @@ export const buildCompleteUser = async (context, client) => { default_hidden_types, groups, organizations, - allowed_organizations, administrated_organizations, individual_id: individualId, inside_platform_organization: isUserPlatform, diff --git a/opencti-platform/opencti-graphql/src/types/user.d.ts b/opencti-platform/opencti-graphql/src/types/user.d.ts index ffb741e92be1..d442a7512d70 100644 --- a/opencti-platform/opencti-graphql/src/types/user.d.ts +++ b/opencti-platform/opencti-graphql/src/types/user.d.ts @@ -35,7 +35,6 @@ interface AuthUser extends BasicStoreIdentifier { roles: Array groups: Array organizations: Array - allowed_organizations: Array administrated_organizations: Array capabilities: Array allowed_marking: Array diff --git a/opencti-platform/opencti-graphql/src/utils/access.ts b/opencti-platform/opencti-graphql/src/utils/access.ts index 3c6e0fcf7b68..08741aa91fd5 100644 --- a/opencti-platform/opencti-graphql/src/utils/access.ts +++ b/opencti-platform/opencti-graphql/src/utils/access.ts @@ -91,7 +91,6 @@ export const SYSTEM_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], default_marking: [], max_shareable_marking: [], @@ -125,7 +124,6 @@ export const RETENTION_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -159,7 +157,6 @@ export const RULE_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -193,7 +190,6 @@ export const AUTOMATION_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -227,7 +223,6 @@ export const DECAY_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -261,7 +256,6 @@ export const GARBAGE_COLLECTION_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -296,7 +290,6 @@ export const REDACTED_USER: AuthUser = { groups: [], capabilities: [], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], @@ -323,7 +316,6 @@ export const TELEMETRY_MANAGER_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], organizations: [], - allowed_organizations: [], allowed_marking: [], max_shareable_marking: [], default_marking: [], diff --git a/opencti-platform/opencti-graphql/tests/02-integration/01-database/file-storage-test.js b/opencti-platform/opencti-graphql/tests/02-integration/01-database/file-storage-test.js index 7f7605ee1499..66fdfea96ad3 100644 --- a/opencti-platform/opencti-graphql/tests/02-integration/01-database/file-storage-test.js +++ b/opencti-platform/opencti-graphql/tests/02-integration/01-database/file-storage-test.js @@ -111,7 +111,6 @@ describe('File storage file listing', () => { user_email: 'user-no-capa@opencti.io', inside_platform_organization: true, allowed_marking: [], - allowed_organizations: [], roles: [{ internal_id: '08f558bc-b93d-40dc-8e86-f70309d9e1a6', id: '08f558bc-b93d-40dc-8e86-f70309d9e1a6', name: 'No capa' }], groups: [], capabilities: [], diff --git a/opencti-platform/opencti-graphql/tests/02-integration/04-manager/notificationManager-test.js b/opencti-platform/opencti-graphql/tests/02-integration/04-manager/notificationManager-test.js index 3c17a70fa74a..5e982b1eae36 100644 --- a/opencti-platform/opencti-graphql/tests/02-integration/04-manager/notificationManager-test.js +++ b/opencti-platform/opencti-graphql/tests/02-integration/04-manager/notificationManager-test.js @@ -273,7 +273,6 @@ describe('Notification manager behaviors test', async () => { groups: [], capabilities: [{ name: 'KNOWLEDGE_KNUPDATE' }], organizations: [], - allowed_organizations: [{ internal_id: userOrganizationId, standard_id: userOrganizationStandardId }], allowed_marking: [{ internal_id: greenMarkingInternalId, standard_id: greenMarkingStandardId }], default_marking: [], all_marking: [], diff --git a/opencti-platform/opencti-graphql/tests/utils/testQuery.ts b/opencti-platform/opencti-graphql/tests/utils/testQuery.ts index d231d16a70c0..89a382331d04 100644 --- a/opencti-platform/opencti-graphql/tests/utils/testQuery.ts +++ b/opencti-platform/opencti-graphql/tests/utils/testQuery.ts @@ -319,7 +319,6 @@ export const ADMIN_USER: AuthUser = { groups: [], capabilities: [{ name: BYPASS }], all_marking: [], - allowed_organizations: [], inside_platform_organization: true, allowed_marking: [], default_marking: [], @@ -695,7 +694,6 @@ export const buildStandardUser = ( groups: [], capabilities: capabilities ?? [{ name: 'KNOWLEDGE_KNUPDATE_KNDELETE' }], all_marking: (allMarkings ?? []) as StoreMarkingDefinition[], - allowed_organizations: [], inside_platform_organization: true, allowed_marking: allowedMarkings as StoreMarkingDefinition[], default_marking: [],