Skip to content

Commit

Permalink
[backend] Get inferred organizations in user platform and hidden types (
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-julien committed Jan 16, 2025
1 parent 112c4f5 commit 21d40ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions opencti-platform/opencti-graphql/src/domain/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,9 @@ export const buildCompleteUser = async (context, client) => {
);
const userGroupsPromise = listAllToEntitiesThroughRelations(context, SYSTEM_USER, client.id, RELATION_MEMBER_OF, ENTITY_TYPE_GROUP);
const settings = await getEntityFromCache(context, SYSTEM_USER, ENTITY_TYPE_SETTINGS);
const allowed_organizations = await listAllToEntitiesThroughRelations(context, SYSTEM_USER, client.id, RELATION_PARTICIPATE_TO, ENTITY_TYPE_IDENTITY_ORGANIZATION);
const userOrganizations = allowed_organizations.map((m) => m.internal_id);
const isUserPlatform = settings.platform_organization ? userOrganizations.includes(settings.platform_organization) : true;
const [individuals, organizations, groups] = await Promise.all([individualsPromise, organizationsPromise, userGroupsPromise]);
const userOrganizationIds = organizations.map((m) => m.internal_id);
const isUserPlatform = settings.platform_organization ? userOrganizationIds.includes(settings.platform_organization) : true;
const roles = await getRoles(context, groups);
const capabilities = await getCapabilities(context, client.id, roles);
const isByPass = R.find((s) => s.name === BYPASS, capabilities) !== undefined;
Expand All @@ -1365,7 +1364,7 @@ export const buildCompleteUser = async (context, client) => {

// Default hidden types
const defaultHiddenTypesGroups = getDefaultHiddenTypes(groups);
const defaultHiddenTypesOrgs = getDefaultHiddenTypes(allowed_organizations);
const defaultHiddenTypesOrgs = getDefaultHiddenTypes(organizations);
const default_hidden_types = uniq(defaultHiddenTypesGroups.concat(defaultHiddenTypesOrgs));

// effective confidence level
Expand Down

0 comments on commit 21d40ee

Please sign in to comment.