feat: SSO for orgs (#13794)
* WIP Adds the capability to add SSO setup in orgs if you are an Admin or an Owner of the org * remove sso setup from teams * allows account creation on first login * auto-add on login and dsync fixes * allow SP & idP initiated login for SAML * revert change to checkIfUserShouldbelongToOrg * fixes SP initiated Login for first time * removed stale comment * code improvement * -- * minor fixes * more fix * add description for non-admin sso settings page
This commit is contained in:
1 parent
452ea6a993
commit
fd91c5da79
9 files changed
+206
-52
No files matched your search
@@ -3,6 +3,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 prisma from "@calcom/prisma";
|
||||
import { IdentityProvider } from "@calcom/prisma/enums";
|
||||
import { getTeamOrThrow } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
|
||||
import type { UserWithMembership } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
|
||||
import { sendExistingUserTeamInviteEmails } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
|
||||
@@ -64,10 +65,13 @@ const handleUserEvents = async (event: DirectorySyncEvent, organizationId: numbe
|
||||
}
|
||||
// If user is not in DB, create user and add to the org
|
||||
} else {
|
||||
await createUsersAndConnectToOrg({
|
||||
const createUsersAndConnectToOrgProps = {
|
||||
emailsToCreate: [userEmail],
|
||||
org,
|
||||
});
|
||||
organizationId: org.id,
|
||||
identityProvider: IdentityProvider.CAL,
|
||||
identityProviderId: null,
|
||||
};
|
||||
await createUsersAndConnectToOrg(createUsersAndConnectToOrgProps);
|
||||
|
||||
await sendSignupToOrganizationEmail({
|
||||
usernameOrEmail: userEmail,
|
||||
|
||||
Reference in new issue
Block a user