Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Domain-wide delegation for Google Calendar and Google Meet #16622

Open
wants to merge 113 commits into
base: main
Choose a base branch
from

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Sep 13, 2024

What does this PR do?

Demo - https://www.loom.com/share/1f9e7c79697847a8bb37490e9873fb26

For feature details refer to README

Detailed Changes

  • getCalendar now requires value of type CredentialForCalendarService which needs an explicit value for delegatedTo. It makes it clear to CalendarService how that Credential should be used.
    • For regular credentials,delegatedTo=null.
    • For DWD credentials, delegatedTo={ serviceAccountKey: { client_email: string; private_key: string; client_id: string;}}
  • google-calendar/CalendarService now supports impersonating a user using the ServiceAccount and thus is capable of taking actions on any of the organization member's behalf on the Google Calendar.

Calendar Cache support is part of #18619

Release Plan

  1. Read the document(domain-wide-delegation.md) and acknowledge it.
  2. Deploy:
    1. Follow "Setting up Domain-Wide Delegation for Google Calendar API" in domain-wide-delegation.md to create Service Account and create a workspace.
    2. Merge PR(without Calendar Cache Support) and then deploy.
  3. Enable for i.cal.com:
    1. Disable Calendar Cache for i.cal.com
    2. Enable teamFeature "domain-wide-delegation" for i.cal.com organization
    3. Create DWD for i.cal.com first and enable it.
    4. Wait for 1-2 days and keep monitoring the errors in Sentry and Axiom.
  4. Merge & Deploy the Calendar Cache support(with DWD) PR
    1. Enable Calendar Cache back for i.cal.com
    2. Observe the errors in Sentry and Axiom.
  5. Enable for a big customer:
    1. Wait for a week and keep monitoring the errors in Sentry and Axiom.
  6. Use delegatedCredentialsFirst instead of delegatedCredentialsLast in EventManager.ts
    - Observe errors in Sentry and Axiom.

Automated Tests

  • Slots Availability - getSchedule.test.ts

  • Google Calendar Service - Calendar.test.ts

  • DomainWideDelegation utiltiies and repository - server.test.ts and domainWideDelegation.test.ts

  • Updating/Setting destinationCalendar - setDestinationCalendar.handler.test.ts

  • Doing a booking - domain-wide-delegation.test.ts

  • Fixes CAL-4610

Screenshot 2024-12-02 at 2 06 02 PM

Possible errors when enabling DWD
image

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Copy link
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Add endpoints for testing the flow". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@github-actions github-actions bot added the ❗️ migrations contains migration files label Sep 13, 2024
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Sep 13, 2024
@hariombalhara hariombalhara changed the title Add endpoints for testing the flow feat: Domain-wide delegation for Google Calendar and Google Meet Sep 13, 2024
@keithwillcode keithwillcode added this to the v4.6 milestone Sep 15, 2024
@hariombalhara hariombalhara force-pushed the domain-wide-delegation-google-calendar branch from 1700348 to 151c3be Compare September 18, 2024 14:19
Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal-com-ui-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 10:52pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2025 10:52pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2025 10:52pm

Copy link
Contributor

github-actions bot commented Sep 19, 2024

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar calendar-apps area: calendar, google calendar, outlook, lark, microsoft 365, apple calendar core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ✨ feature New feature or request platform Anything related to our platform plan ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants