fix: Allow all team members to view hidden fields and UTM tracking data#24619
fix: Allow all team members to view hidden fields and UTM tracking data#24619
Conversation
- Add team admin permission check for booking data visibility - Team admins can now view hidden booking field answers - Team admins can now view UTM tracking parameters - Support for managed events (parent team admins can view child event data) - Maintain backward compatibility with existing host permissions Fixes team admin access to booking details as requested in issue.
Previously only team admins could view hidden booking field answers and UTM tracking parameters. Now all team members can see this data, providing better transparency within teams. - Changed from isTeamAdmin to isTeamMember check - Team members (not just admins) can now view hidden booking fields - Team members can now view UTM tracking parameters - Maintains host permission (organizers can still see everything) - Supports managed events (parent team members can view child event data)
- Remove custom checkIfUserIsTeamAdmin function - Use existing userId_teamId pattern with prisma.membership.findUnique - Revert PrismaPlugin and variable name changes - Maintain same functionality with cleaner implementation
- Replace isTeamAdmin with isTeamMember in booking view permissions - Rename isLoggedInUserTeamAdmin to isLoggedInUserTeamMember for clarity - All team members can now view hidden fields and UTM tracking data Addresses feedback from @hariombalhara to allow all team members (not just admins) to see hidden booking data. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
- Change import from non-existent @calcom/lib/server/queries/teams - Use correct path @calcom/features/ee/teams/lib/queries - Fixes type check error: Cannot find module Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
neha seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
- Extract teamId using nullish coalescing operator - Single isTeamMember call instead of two - Cleaner and more efficient logic Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Reviewed changes from recent commits (found 1 issue).
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx">
<violation number="1" location="apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx:180">
This change stops checking parent-team membership when an event has its own team. If a user is only a member of the parent team (previously supported), `eventType.team?.id` short-circuits the nullish coalescing, so `isTeamMember` is invoked only for that team and returns false, blocking the user from hidden data they used to see. Please restore the fallback check that also tests `eventType.parent?.teamId`.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
Show resolved
Hide resolved
- Resolved merge conflict by keeping both BookingRepository and isTeamMember imports - Fixed team membership check to properly check both team.id and parent.teamId - This addresses the cubic-dev-ai comment about ensuring users who are only members of the parent team can still view hidden data Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
87d1b80 to
3eca27d
Compare
3eca27d to
c240aac
Compare
E2E results are ready! |
Udit-takkar
left a comment
There was a problem hiding this comment.
LGTM.
Can you fix all the conflicts?
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
|
@Udit-takkar fixed conflicts |
What does this PR do?
Fixes #23864
Based on #23878
This PR expands the permission logic for viewing hidden booking data to include all team members, not just event hosts. Previously, only the event host could view hidden booking fields and UTM tracking parameters. Now, any team member can view this data.
Changes:
Server-side (
bookings-single-view.getServerSideProps.tsx):isTeamMembercheck to determine if the logged-in user is a member of the event's teamcanViewHiddenDataprop that is true for both hosts and team memberscanViewHiddenDataClient-side (
bookings-single-view.tsx):canViewHiddenDatainstead ofisHostAdditional UI changes (scope unclear):
canCancelAndRescheduleLink to Devin run: https://app.devin.ai/sessions/537d2cd15a8f4473b64c17853c40c9ba
Requested by: @hariombalhara
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Test scenario:
?utm_source=test&utm_campaign=demo)Expected behavior:
Important notes:
eventType.teamandeventType.parent.teamIdscenariosHuman Review Checklist
isTeamMemberbe called twice (once forteam.id, once forparent.teamId), or can this be optimized to a single call?Checklist