One source for the tenant on every page, and 404 for unknown tenants #7
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#6 Participant pages: read the tenant from inject:tenant, like the admin area
ijug-ev/registration
Reference
ijug-ev/registration!7
Loading…
Reference in a new issue
No description provided.
Delete branch "participant-tenant-bean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The admin pages already got the tenant from the
@Named("tenant")beanCurrentTenant(inject:tenant). The participant pages still had it passed in as page data, and it meant something different depending on the page:registration.htmlandthanks.htmlTenantentity in the meeting pagesThe build does not check plain data keys, but it does check
inject:expressions. So a wrong expression on a participant page did not fail. It rendered something that looked fine: a dead unsubscribe link, orTenant(id=…)printed into the page.A tenant id with a typo (for example in a JUG's iframe) also gave either a page with an empty logo and dead links, or a 500 wherever the events URL was needed.
What changes
inject:tenant:registration.html,thanks.html,logoheader.htmland the two meeting pages.RegistrationResourceandMeetingResourceno longer passtenantas data. A typo such as{inject:tenant.websit}now fails the build, with file and line.CurrentTenantgainsgetWebsite(),getPrivacy()andgetImprint(). It stays a small wrapper rather than exposing the entity, soreplyTo,eventsandcsscannot reach a page.TenantAccessFilteranswers 404 for an unknown tenant.TenantContext.getTenant()returnsnullinstead of callingTenant.findById(null)on endpoints that have no{tenant}path segment. This check used to be repeated inTenantStyle.EmailService. They were left out of this change on purpose.Behavior change
/registration/{x}?eventId=…/registration/{x}/delete/registration/{x}/ical/{eventId}/meeting/{x}/{eventId}Known tenants behave as before.
Pitfall worth knowing
The filter checks that the tenant exists with
Tenant.count(...)and does not load it viatenantContext.getTenant(). Loading the entity in the filter caches it outside any transaction. A later@Transactionalresource then changes an entity its own session does not manage. That is what happened with the JUG data form: it saved nothing and reported no error.testTenantCssStylesTheParticipantPagesOnlycaught it. The reason is written down in the filter's code comment and inCLAUDE.md.Tests
tenantFieldOfTemplate(...)instead of being hardcoded../mvnw test.Docs
CLAUDE.mdand the javadoc ofCurrentTenant,TenantStyleandTenantContextare updated. Two new notes inCLAUDE.md:count()(the pitfall above)quarkus:devruns needs a restart with./mvnw clean compile quarkus:devView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.