Skip to content

Commit

Permalink
[backend] Fix platform groups sync through providers login (#8867)
Browse files Browse the repository at this point in the history
Co-authored-by: 한승윤 <[email protected]>
  • Loading branch information
savannah030 and 한승윤 authored Nov 1, 2024
1 parent e788171 commit 9d2cbe6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opencti-platform/opencti-graphql/src/domain/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,8 @@ export const loginFromProvider = async (userInfo, opts = {}) => {
const userGroups = await listAllToEntitiesThroughRelations(context, SYSTEM_USER, user.id, RELATION_MEMBER_OF, ENTITY_TYPE_GROUP);
const deleteGroups = userGroups.filter((o) => !providerGroups.includes(o.name));
for (let index = 0; index < deleteGroups.length; index += 1) {
const userGroup = userGroups[index];
await userDeleteRelation(context, SYSTEM_USER, user, userGroup.id, RELATION_MEMBER_OF);
const deleteGroup = deleteGroups[index];
await userDeleteRelation(context, SYSTEM_USER, user, deleteGroup.id, RELATION_MEMBER_OF);
}
// 02 - Create groups from providers
const createGroups = providerGroups.filter((n) => !userGroups.map((o) => o.name).includes(n));
Expand Down

0 comments on commit 9d2cbe6

Please sign in to comment.