Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Grab booking organizer credentials when team admins request reschedule#24645

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Udit-takkar merged 25 commits intomainfromfix-request-reschedule-by-non-organizer
Nov 25, 2025

Conversation

@joeauyeung
Copy link
Contributor

@joeauyeungjoeauyeung commentedOct 22, 2025
edited by cubic-dev-aibot
Loading

What does this PR do?

  • When requesting reschedule for a booking, grab the booking organizer credentials to delete calendar events, instead of the user initiating the reschedule request
  • Fixing naming convention around request reschedule frombookingUId tobookingUid inline with other places in the codebase

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require adocumentation 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?

  • Create a team booking with a calendar event
  • Request reschedule for the booking as a team admin

Summary by cubic

Fixes reschedule requests for team bookings by using the organizer’s credentials to cancel calendar/video events and enforcing permissions. Also switches the API input to bookingUid.

  • Bug Fixes

    • Use booking organizer credentials to delete calendar/video events on reschedule.
    • Enforce team permissions with booking.update for admins/owners; block unauthorized users.
    • Prevent reschedule on cancelled or rejected bookings.
  • Migration

    • requestReschedule input renamed: bookingId -> bookingUid.

Written for commit78d994e. Summary will update automatically on new commits.

@keithwillcodekeithwillcode added corearea: core, team members only enterprisearea: enterprise, audit log, organisation, SAML, SSO labelsOct 22, 2025
devin-ai-integrationbot added a commit that referenced this pull requestOct 22, 2025
…entials- Add test for team admin requesting reschedule with proper permissions- Add test verifying organizer's credentials are used (not requester's)- Add test for team member without permissions (should fail)These tests cover the fix in PR#24645 which ensures that when a team adminrequests a reschedule, the booking organizer's credentials are used to deletecalendar events instead of the requester's credentials.Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…entials- Add test for team admin requesting reschedule with proper permissions- Add test verifying organizer's credentials are used (not requester's)- Add test for team member without permissions (should fail)These tests cover the fix in PR#24645 which ensures that when a team adminrequests a reschedule, the booking organizer's credentials are used to deletecalendar events instead of the requester's credentials.Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
@vercel
Copy link

vercelbot commentedOct 23, 2025
edited
Loading

The latest updates on your projects. Learn more aboutVercel for GitHub.

2 Skipped Deployments
ProjectDeploymentPreviewCommentsUpdated (UTC)
calIgnoredIgnoredNov 25, 2025 7:00am
cal-euIgnoredIgnoredNov 25, 2025 7:00am

@github-actions
Copy link
Contributor

github-actionsbot commentedOct 28, 2025
edited
Loading

E2E results are ready!

isOpenDialog={isOpenRescheduleDialog}
setIsOpenDialog={setIsOpenRescheduleDialog}
bookingUId={booking.uid}
bookingUid={booking.uid}
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Throughout the codebase we usebookingUid so cleaning this up to be more consistent.

onClick={()=>{
rescheduleApi({
bookingId,
bookingUid,
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We're actually passing thebookingUid instead of the id here so cleaning this up to be more clear.

hariombalhara reacted with thumbs up emoji
* It includes in-memory DelegationCredential credentials as well.
*/
exportasyncfunctiongetUsersCredentialsIncludeServiceAccountKey(user:User){
exportasyncfunctiongetUsersCredentialsIncludeServiceAccountKey(user:{id:number;email:string}){
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Changed the type here to only require the params that are used in the function rather than the broaderUser type

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Moved these two prisma calls fromrequestReschedule.handler to theBookingRepository

constbookingToReschedule=awaitbookingRepository.findBookingForRequestReschedule({ bookingUid});

if(!bookingToReschedule.userId){
if(!bookingToReschedule)return;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Moved this early return right after when the query is made.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

findBookingForRequestReschedule already throws when it can't find the booking, so this is probably dead code

Comment on lines +67 to +74
if(!isBookingOrganizer&&bookingBelongsToTeam&&bookingToReschedule.eventType?.teamId){
constpermissionCheckService=newPermissionCheckService();
consthasPermission=awaitpermissionCheckService.checkPermission({
userId:user.id,
teamId:bookingToReschedule.eventType.teamId,
permission:"booking.update",
fallbackRoles:["ADMIN","OWNER"],
});
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Replaced this manual check with thePermissionCheckService. Shoutout@sean-brydon

Udit-takkar reacted with heart emoji
Copy link
Contributor

@cubic-dev-aicubic-dev-aibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No issues found across 6 files

}

constbookingBelongsToTeam=!!bookingToReschedule.eventType?.teamId;
constisBookingOrganizer=bookingToReschedule.userId===user.id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In case of multiple hosts (collective or round robin event type) thenisBookingOrganizer would be false in case the second host clicks on request reschedule

hariombalhara reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It should only be the single organizer because we use their credentials for the calendar event.

Copy link
Contributor

@Udit-takkarUdit-takkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

left some comments

if(!bookingToReschedule.userId){
if(!bookingToReschedule)return;

if(!bookingToReschedule.userId||!bookingToReschedule.user){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Isn't user the relation foruserId ? By that logic both will either be set together or null together. So, one of the checks should suffice

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We need to keep this in here or we'll throw a type error

Copy link
Member

@hariombalharahariombalhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice edge case handling !!

Have added some comments. Feel free to implement what makes sense

@github-actionsgithub-actionsbot marked this pull request as draftNovember 17, 2025 08:01
@joeauyeung
Copy link
ContributorAuthor

@hariombalhara@Udit-takkar removed business logic references from the repository methods. Decided to keep the business logic in the handler for now.

@joeauyeungjoeauyeung marked this pull request as ready for reviewNovember 20, 2025 22:03
Copy link
Contributor

@cubic-dev-aicubic-dev-aibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No issues found across 6 files

Copy link
Contributor

@Udit-takkarUdit-takkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@joeauyeung type checks are failing

Copy link
Contributor

@cubic-dev-aicubic-dev-aibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No issues found across 6 files

@Udit-takkarUdit-takkarenabled auto-merge (squash)November 25, 2025 07:00
@Udit-takkarUdit-takkar merged commit2b2bf36 intomainNov 25, 2025
37 of 38 checks passed
@Udit-takkarUdit-takkar deleted the fix-request-reschedule-by-non-organizer branchNovember 25, 2025 07:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cubic-dev-aicubic-dev-ai[bot]cubic-dev-ai[bot] left review comments

@Udit-takkarUdit-takkarUdit-takkar approved these changes

@hariombalharahariombalharahariombalhara left review comments

Assignees

No one assigned

Labels

corearea: core, team members onlyenterprisearea: enterprise, audit log, organisation, SAML, SSOready-for-e2esize/XL

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@joeauyeung@hariombalhara@Udit-takkar@keithwillcode

[8]ページ先頭

©2009-2025 Movatter.jp