fix: SCIM improvements (#16103)
* Add error logging for body * Use user repository
This commit is contained in:
1 parent
53ec5daa1b
commit
3b186b19e6
3 files changed
+15
-4
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import type { DirectorySyncEvent, Group } from "@boxyhq/saml-jackson";
|
||||
|
||||
import jackson from "@calcom/features/ee/sso/lib/jackson";
|
||||
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import prisma from "@calcom/prisma";
|
||||
@@ -14,7 +13,6 @@ import {
|
||||
import createUsersAndConnectToOrg from "./users/createUsersAndConnectToOrg";
|
||||
|
||||
const handleGroupEvents = async (event: DirectorySyncEvent, organizationId: number) => {
|
||||
const { dsyncController } = await jackson();
|
||||
// Find the group name associated with the event
|
||||
const eventData = event.data as Group;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { DirectorySyncEvent, User } from "@boxyhq/saml-jackson";
|
||||
|
||||
import removeUserFromOrg from "@calcom/features/ee/dsync/lib/removeUserFromOrg";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { IdentityProvider } from "@calcom/prisma/enums";
|
||||
import { getTeamOrThrow } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
|
||||
@@ -25,7 +26,7 @@ const handleUserEvents = async (event: DirectorySyncEvent, organizationId: numbe
|
||||
});
|
||||
|
||||
// User is already a part of that org
|
||||
if (user?.organizationId && eventData.active) {
|
||||
if (user && UserRepository.isAMemberOfOrganization({ user, organizationId }) && eventData.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user