Uh oh!
There was an error while loading. Please reload this page.
fix(permissions): scope tickets and bookings by attendee, not row creator - #359
Merged
Conversation
…ator Backport of #358. `develop` carries the fix inside the team permission hooks (`buzz/permissions.py`), which `main` does not have, so the cherry-pick could not apply. This reimplements the same rule against `main`'s permission model. My Tickets showed nothing to the people the tickets belong to. `if_owner` on the Buzz User read permission decided "mine" by `owner` — whoever created the row — so a ticket created by the booker, or a guest-checkout booking created as Administrator, was invisible to the attendee and to the buyer. `if_owner` comes off both doctypes and the decision moves to a pair of hooks in `buzz.permissions`, which match the column that names the person: `Event Ticket.attendee_email`, `Event Booking.user`, plus tickets belonging to a booking the user made. System Manager and Event Manager still read every row. `TicketService.details` asked its own attendee-only question and would have rejected the rows the list now shows; it asks the read permission instead. `booking_owned_by_user` compared `owner`, so a guest-checkout buyer never got their own booking back. Delete also comes off the Buzz User role on Event Booking. Bookings are cancelled, never deleted; with `if_owner` gone the grant would have let a buyer delete their own draft booking and its child rows through the document API. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Greptile SummaryThe PR replaces creator-based ticket and booking visibility with attendee/buyer-aware permission hooks and aligns ticket details and dashboard discovery with those rules.
Confidence Score: 5/5The PR appears safe to merge, with the new permission model consistently enforced across list and document access. The changed hooks scope bookings and tickets to their creator, named user or attendee, and booking buyer while preserving privileged access and retaining role-level restrictions on writes and deletion; no actionable changed-code failure remains.
|
| Filename | Overview |
|---|---|
| buzz/permissions.py | Introduces consistent owner, attendee, and buyer scoping for query-level and document-level permission checks. |
| buzz/hooks.py | Registers the new permission handlers for Event Booking and Event Ticket without disturbing the existing Talk Proposal hooks. |
| buzz/api/tickets/services.py | Delegates ticket-detail authorization to the shared read permission and returns booking data to its recorded buyer or creator. |
| buzz/ticketing/doctype/event_booking/event_booking.json | Removes creator-only scoping and portal deletion while retaining the intended booking read/write capabilities. |
| buzz/ticketing/doctype/event_ticket/event_ticket.json | Removes creator-only read scoping so the new attendee and buyer permission conditions can govern visibility. |
| dashboard/src/pages/TicketsList.vue | Removes the attendee-only client filter so server-authorized tickets booked for other people remain discoverable. |
| buzz/test_permissions.py | Covers attendee, buyer, outsider, creator, deletion, write, and privileged-role permission behavior. |
Reviews (1): Last reviewed commit: "fix(permissions): scope tickets and book..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manual backport of #358 to
main.The Backport action failed on this one and it is not the action's fault. On
developthe fix lives insidebuzz/permissions.py, the team-multi-tenancy module from #312, whichmaindoes not have. The cherry-pick hitCONFLICT (modify/delete): buzz/permissions.py deleted in HEAD, so there was nothing to auto-resolve. Everything else in the commit applied cleanly.This reimplements the same rule against
main's permission model instead.The bug
My Tickets showed nothing to the people the tickets belong to.
if_owneron the Buzz User read permission decides "mine" byowner— whoever created the row. A ticket created by the booker, or a guest-checkout booking created as Administrator, names neither the attendee nor the buyer, so both were invisible.What changed
if_ownercomes off the Buzz User read permission on Event Ticket and Event Booking. Frappe ANDs it onto every query, so no attendee clause could ever have passed alongside it.buzz/permissions.pywith apermission_query_conditions/has_permissionpair for both doctypes. Matchesowner, plus the column naming the person (Event Ticket.attendee_email,Event Booking.user), plus tickets belonging to a booking the user made. System Manager, Event Manager and Administrator are unaffected — they short-circuit to full access.TicketService.detailsasked its own attendee-only question and would have rejected the rows the list now shows. It asks the read permission instead.booking_owned_by_usercomparedowner, so a guest-checkout buyer never got their own booking back.if_ownergone the grant would have let a buyer delete their own draft booking and its child rows through the document API.TicketsList.vuedrops itsattendee_emailfilter — the permission query does that now, and the filter would have hidden tickets the user booked for others.Not the same file as develop
main'sbuzz/permissions.pyis a stripped module: no teams, noBuzz Team Membership, just the ownership question. Function names match develop's (belongs_to_user,my_bookings,IDENTITY_FIELDS) so that whenever the teams stack lands onmain, develop's version overwrites this one rather than merging against it.derived_has_permission's unstamped-event carve-out from #358 has no counterpart here — there are no team-stamped events onmain.Verified
bench --site buzz.localhost run-testson the ticketing, tickets API, guest booking, check-in, sponsorships and talk proposal modules, plus the 9 new tests inbuzz/test_permissions.py. All green.