Skip to content

Commit 1625af7

Browse files
[backend] Adapt dynamic filtering for special instance control (#4538)
1 parent 7f62490 commit 1625af7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

opencti-platform/opencti-graphql/src/utils/access.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ export const userFilterStoreElements = async (context: AuthContext, user: AuthUs
440440
// If element is shared, user must have a matching sharing organization
441441
return elementOrganizations.some((r) => userOrganizations.includes(r));
442442
}
443-
// If no platform organization is set, user can access empty sharing and dedicated sharing
444-
return elementOrganizations.length === 0 || elementOrganizations.some((r) => userOrganizations.includes(r));
443+
// If no platform organization is set, user can
444+
return true;
445445
});
446446
};
447447
return telemetry(context, user, 'FILTERING store filter', {
@@ -491,8 +491,8 @@ export const isUserCanAccessStixElement = async (context: AuthContext, user: Aut
491491
// If element is shared, user must have a matching sharing organization
492492
return elementOrganizations.some((r) => userOrganizations.includes(r));
493493
}
494-
// If no platform organization is set, user can access empty sharing and dedicated sharing
495-
return elementOrganizations.length === 0 || elementOrganizations.some((r) => userOrganizations.includes(r));
494+
// If no platform organization is set, user can access
495+
return true;
496496
};
497497

498498
// region member access

opencti-platform/opencti-graphql/tests/02-integration/04-manager/notificationManager-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ describe('Notification manager behaviors test', async () => {
13921392

13931393
// O is a green organization, trigger on O and another organization
13941394
result = await buildTargetEvents(context, users, streamEventShareMalwareWithGreenOrganization, triggerOrganizationsAllEvents, true);
1395-
expect(result.length).toEqual(1);
1395+
expect(result.length).toEqual(2);
13961396
expect(result[0].type).toEqual(EVENT_TYPE_UPDATE);
13971397
expect(result[0].message).toEqual('[identity] greenOrganization_name added in [malware] malware_name');
13981398

0 commit comments

Comments
 (0)