Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/utils/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ const fetchMembersWithOrgaRestriction = async (
const platformSettings = await getEntityFromCache<BasicStoreSettings>(context, SYSTEM_USER, ENTITY_TYPE_SETTINGS);

// case 1.1. no orga restriction on user visibility
if (userCanViewAllUsers || !platformSettings.platform_organization || platformSettings.view_all_users) {
if (userCanViewAllUsers || (!platformSettings.platform_organization && platformSettings.view_all_users)) {
return membersFetchFunction(context, user, types, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,9 @@ describe('User list members query behavior', () => {
it('Should user lists all members', async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename the test to Should list allowed members according to organization restriction or something else than list all members now that we don't

const queryResult = await queryAsUser(USER_EDITOR, { query: LIST_MEMBERS_QUERY, variables: {} });
const usersEdges = queryResult.data?.members.edges as { node: Member }[];
expect(usersEdges.length).toEqual(25);
expect(usersEdges.filter(({ node: { entity_type } }) => entity_type === ENTITY_TYPE_USER).length).toEqual(TESTING_USERS.length + 1); // +1 = Plus admin user
expect(usersEdges.length).toEqual(23);
// +1 = Plus admin user minus 2 users in PLATFORM_ORGANIZATION
expect(usersEdges.filter(({ node: { entity_type } }) => entity_type === ENTITY_TYPE_USER).length).toEqual(TESTING_USERS.length + 1 - 2);
expect(usersEdges.filter(({ node: { entity_type } }) => entity_type === ENTITY_TYPE_GROUP).length).toEqual(entitiesCounter.Group);
expect(usersEdges.filter(({ node: { entity_type } }) => entity_type === ENTITY_TYPE_IDENTITY_ORGANIZATION).length).toEqual(entitiesCounter.Organization + 1);
});
Expand Down
Loading