You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove unused return statement
* Fix return from fn instead of continuing the loop
* Ensure userId is set for existing records on update
* ensure that serviceAccountKey is only retrieved whenb assked
Copy file name to clipboardExpand all lines: packages/features/delegation-credentials/README.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,8 +95,7 @@ Step 6: Enable Delegation Credential(To Be taken By Cal.com organization Owner/A
95
95
### Terminology
96
96
97
97
- Delegation Credential: A Delegation Credential service account key along with user's email becomes the Delegation Credential which is an alternative to regular Credential in DB.
98
-
- DWD: Domain Wide Delegation
99
-
- non-dwd credential: Regular credentials that are stored in Credentials table
98
+
- Delegation User Credential: A Delegation User Credential is a Credential record in DB that uses DelegationCredential record to actually access the user's calendar. A Credential record with delegationCredentialId set is a Delegation User Credential.
100
99
101
100
### How Delegation Credential works
102
101
@@ -108,6 +107,13 @@ Step 6: Enable Delegation Credential(To Be taken By Cal.com organization Owner/A
108
107
- A Delegation Credential service account key along with user's email becomes the Delegation Credential which is an alternative to regular Credential in DB.
109
108
- Delegation Credential doesn't completely replace the regular credentials. Delegation Credential gives access to the cal.com user's email in Google Calendar. So, if the user needs to connect to some other email's calendar, we need to use the regular credentials.
110
109
110
+
### Cron Jobs
111
+
112
+
Cron jobs ensure that for each and every member of the organization that has Delegation Credential enabled, corresponding SelectedCalendar records are there. These crons currently run every 5 minutes, look at vercel.json for the up-to-date schedule.
113
+
114
+
-`credentials` cron job creates Delegation User Credential records for all the members of the organization who don't have Delegation User Credentials yet. It also ensures that on disabling Delegation Credential, the Delegation User Credentials are deleted which automatically deletes the SelectedCalendars through DB cascade.
115
+
-`selected-calendars` cron job creates SelectedCalendar records for all the Delegation User Credentials of the organization who don't have Selected Calendars yet.
116
+
111
117
### Important Points
112
118
113
119
- No Credential table entry is created when enabling Delegation Credential. The workspace platform's related apps will be considered as "installed" for the users with email matching dwd domain. An in-memory credential like object is created for this purpose. It allows avoiding creation of thousands of records for all the members of the organization when Delegation Credential is enabled.
@@ -122,27 +128,26 @@ Step 6: Enable Delegation Credential(To Be taken By Cal.com organization Owner/A
122
128
1. Identify the logged in user's email
123
129
2. Identify the domainWideDelegations for that email's domain
124
130
3. Build in-memory credentials for the domainWideDelegations and use them along with the actual credentials(that user might have connected) of the user
125
-
4. We don't show the non-dwd connected calendar(if there is a corresponding dwd connected calendar). Though we use the non-dwd credentials to identify the selected calendars, for the dwd connected calendar.
131
+
4. We don't show the non DelegationCredential connected calendar(if there is a corresponding DelegationCredential connected calendar). Though we use the non DelegationCredential credentials to identify the selected calendars, for the DelegationCredential connected calendar.
126
132
127
133
### Impact of disabling Delegation Credential
128
134
129
-
Disabling effectively stops generating in-memory delegation user credentials. So, any members who haven't manually connected their Calendar and thus their calendar connections were working only because of Delegation Credential, would have their connections broken.
130
-
131
-
#### What would not work correctly ?
132
-
133
-
- Calendar won't be checked for conflicts. So, they could get booked at a time when they are marked busy in their calendar.
134
-
- Cal.com bookings would still be checked for conflicts.
135
-
- Bookings might not appear in the attendee and host's Google Calendar. Because we would be unable to use the API to create the events in calendar and Google doesn't always add events to calendar automatically based on .ics file alone.
136
-
- Cal Video would be used as the booking location instead of Google Meet.
135
+
Disabling effectively stops generating in-memory delegation user credentials. So, any members who haven't manually connected their Calendar and thus their calendar connections were working only because of Delegation Credential, would have their calendar connections broken.
137
136
138
-
#### What would work correctly ?
139
-
140
-
- Bookings would still go through. People relying on Salesforce for booking details, would face no issues.
141
-
-Cal.com bookings would still be checked for conflicts.
137
+
###Impact of enabling Delegation Credential
138
+
- Existing calendar-cache records are re-used as we identify the relevant record by userId and key of CalendarCache record.
139
+
- Any updates to those calendar-cache records keep on working by using the non-delegation credential attached with the SelectedCalendar record.
140
+
-For any new members, we create Credential records and SelectedCalendar records through cron jobs and thus their calendar-cache records will also be created.
142
141
143
142
### Notes when testing locally
144
143
145
144
- You need to enable the feature through feature flag.
146
145
- You could use Acme org and login as <owner1-acme@example.com>
147
146
- Make sure to change the email of the user above to your workspace owner's email(other member's email might also work). This is necessary otherwise you won't be able to enable Delegation Credential for the organization.
148
147
- Note: After changing the email, you would have to logout and login again
148
+
149
+
150
+
151
+
## TODO
152
+
- Test what happens when credential expires that was used in CalendarCache/SelectedCalendar
153
+
- It seems that if refresh token is valid then it would still be refreshed but if it becomes invalid then it ends up causing the calendar-cache updates to break because it isn't able to renew the access token. How do you fix it?
0 commit comments