Skip to content

feat: event tenant domain#129

Merged
danielhe4rt merged 4 commits into
3.xfrom
feat/event-tenant-domain
Nov 26, 2025
Merged

feat: event tenant domain#129
danielhe4rt merged 4 commits into
3.xfrom
feat/event-tenant-domain

Conversation

@danielhe4rt
Copy link
Copy Markdown
Contributor

@danielhe4rt danielhe4rt commented Nov 26, 2025

Summary by CodeRabbit

  • New Features

    • Added tenant domain configuration for improved site management
    • User avatars now displayed in admin interface with provider integration
    • Admin role management via configurable username list
  • Improvements

    • Event ticket display enhanced with updated messaging and participant dashboard access information
    • Event location now displays dynamically instead of static placeholder
    • OAuth authentication flow optimized with improved redirect handling
  • Tests

    • Added domain field coverage to tenant creation and edit tests

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR refactors the authentication and tenant identification system, renaming route parameters from tenantSlug to tenant, adding domain support to tenants, extending provider models with avatar/username fields, integrating Filament user features, and updating event theme components to use dynamic data instead of hardcoded values.

Changes

Cohort / File(s) Summary
Authentication Route & Response Updates
app-modules/authentication/routes/authentication-routes.php, app-modules/authentication/src/Http/Responses/TenantLogoutResponse.php
Route parameter renamed from {tenantSlug} to {tenant} in logout route; response now passes ['tenant' => $tenantSlug] key to Filament login URL.
OAuth Controller & Flow
app-modules/authentication/src/Http/Controllers/OAuthController.php
Added early-exit branches for null tenant and event-panel cases with new helper methods eventRedirectResponse() and basePanelRedirectResponse(); replaced redirect()->intended() with redirect()->to() for final redirect.
Authentication Action
app-modules/authentication/src/Actions/AuthenticateAction.php
Removed conditional auth check; unconditionally performs logout, login, and Filament user set; extended provider payload with avatar and username fields.
Filament Event Login
app-modules/authentication/src/Filament/Shared/EventLogin.php
Renamed public property tenantSlug to tenant; updated mount method signature and internal references; changed form data key from 'tenantSlug' to 'tenant'.
OAuth Connect Component
app-modules/he4rt/resources/views/components/partials/oauth-connect.blade.php
Renamed prop from tenantSlug to tenant; updated redirect URI call to use new prop name.
Event Theme Components
app-modules/events/resources/views/components/themes/3pontos/components/sections/event-ticket.blade.php, app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php, app-modules/events/resources/views/components/themes/3pontos/participant-dashboard.blade.php
Updated hardcoded content to use dynamic values; replaced static text with $event->location, updated badge/titles to Portuguese, passed event data via :event prop binding.
Event Admin Panel
app-modules/events/src/AdminEventPanelPlugin.php, app-modules/events/src/Filament/Events/EventLandingPage.php, app-modules/events/src/Filament/Events/ParticipantDashboard.php
Removed ActiveEventsStats widget registration; added getViewData() method to ParticipantDashboard to provide event context; minor formatting cleanup.
Provider Model Extensions
app-modules/provider/database/migrations/2023_01_18_210724_create_providers_table.php, app-modules/provider/src/Models/Provider.php
Added nullable avatar and username columns to providers table; added fields to model's fillable array.
Tenant Domain Feature
app-modules/tenant/database/migrations/2025_11_25_184549_add_domain_to_tenants_table.php, app-modules/tenant/src/Models/Tenant.php, app-modules/tenant/src/Filament/Admin/Resources/Tenants/Schemas/TenantForm.php, app-modules/tenant/tests/Feature/Filament/Admin/Tenant/*
Added nullable domain column to tenants table; added domain field to model's fillable array; added required domain field to tenant form with debounced name validation and partial rendering; updated tests to include domain field.
User Model Filament Integration
app-modules/user/src/Models/User.php
Implemented FilamentUser interface; changed admin check from fixed email to username-based config lookup; added canAccessPanel() and getFilamentAvatarUrl() methods.
User Panel Plugin
app-modules/user/src/Plugins/AdminUserPanelPlugin.php
Removed UsersStatsOverview widget registration and its import.
Tenant Identification
app/Http/Middleware/GuestTenantIdentifier.php
Updated to lookup tenant by slug or domain via Tenant::query(); conditionally sets tenant context or defaults to guest panel.
Filament Panel Configuration
app/Providers/Filament/EventPanelProvider.php, app/Providers/Filament/GuestPanelProvider.php, bootstrap/providers.php
Updated route parameters from tenantSlug to tenant; added conditional path and domain configuration for production; reordered provider load sequence; updated login/logout URL builders to use Filament tenant context.
Configuration
config/he4rt.php
Added 'admins' config entry with comma-separated usernames from HE4RT_ADMINS_USERNAMES environment variable, defaulting to 'danielhe4rt,kaster'.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant OAuthController
    participant AuthenticateAction
    participant OAuthStateDTO
    participant Helper1 as eventRedirectResponse
    participant Helper2 as basePanelRedirectResponse
    participant Redirect

    Client->>OAuthController: POST /callback
    OAuthController->>OAuthController: getAuthenticate()
    
    alt state.tenant is null
        OAuthController->>Helper2: basePanelRedirectResponse(state)
        Helper2->>Redirect: redirect()->intended(panelUrl)
        Redirect-->>Client: Redirect to panel
    else state.panel is 'event'
        OAuthController->>Helper1: eventRedirectResponse(state)
        Helper1->>Helper1: Fetch Tenant by slug
        Helper1->>Helper1: Derive baseUri
        Helper1->>Redirect: redirect to participant-dashboard
        Redirect-->>Client: Redirect to dashboard
    else Normal flow
        OAuthController->>AuthenticateAction: handle()
        AuthenticateAction->>AuthenticateAction: logout(), login(), setFilamentUser()
        AuthenticateAction->>AuthenticateAction: Create/update provider with avatar, username
        OAuthController->>Redirect: redirect()->to($redirectUri)
        Redirect-->>Client: Redirect to intended URL
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • OAuth flow changes in OAuthController: New conditional branches and helper methods require careful review of redirect logic and state handling
  • AuthenticateAction modifications: Removal of conditional auth checks changes authentication behavior; verify logout/login sequence is intentional
  • Parameter renames across multiple files: Ensure consistency of tenantSlugtenant renaming across routes, controllers, views, and configurations
  • Tenant identification middleware: New domain-based lookup logic affects how tenants are identified; verify fallback to guest panel is correct
  • Provider model extensions: Verify avatar/username persistence in OAuth flow integrates correctly with AuthenticateAction changes
  • Filament integration in User model: Review new admin access logic based on username config and avatar URL generation

Possibly related PRs

Suggested reviewers

  • gvieira18
  • RichardGL11
  • Clintonrocha98

Poem

🐰 Parameter renames dance through routes so neat,
Tenant domains now make auth complete,
From slugs to tenants, the OAuth flow redirects with grace,
Provider avatars and usernames find their place,
Event dashboards bloom with dynamic flair!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/event-tenant-domain

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4032c7 and d35ece7.

📒 Files selected for processing (26)
  • app-modules/authentication/routes/authentication-routes.php (1 hunks)
  • app-modules/authentication/src/Actions/AuthenticateAction.php (2 hunks)
  • app-modules/authentication/src/Http/Controllers/OAuthController.php (1 hunks)
  • app-modules/authentication/src/Http/Responses/TenantLogoutResponse.php (1 hunks)
  • app-modules/events/resources/views/components/themes/3pontos/components/sections/event-ticket.blade.php (2 hunks)
  • app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php (1 hunks)
  • app-modules/events/resources/views/components/themes/3pontos/participant-dashboard.blade.php (1 hunks)
  • app-modules/events/src/AdminEventPanelPlugin.php (0 hunks)
  • app-modules/events/src/Filament/Events/EventLandingPage.php (0 hunks)
  • app-modules/events/src/Filament/Events/ParticipantDashboard.php (1 hunks)
  • app-modules/events/src/Filament/Shared/EventLogin.php (2 hunks)
  • app-modules/he4rt/resources/views/components/partials/oauth-connect.blade.php (2 hunks)
  • app-modules/provider/database/migrations/2023_01_18_210724_create_providers_table.php (1 hunks)
  • app-modules/provider/src/Models/Provider.php (1 hunks)
  • app-modules/tenant/database/migrations/2025_11_25_184549_add_domain_to_tenants_table.php (1 hunks)
  • app-modules/tenant/src/Filament/Admin/Resources/Tenants/Schemas/TenantForm.php (1 hunks)
  • app-modules/tenant/src/Models/Tenant.php (1 hunks)
  • app-modules/tenant/tests/Feature/Filament/Admin/Tenant/CreateTenantTest.php (4 hunks)
  • app-modules/tenant/tests/Feature/Filament/Admin/Tenant/EditTenantTest.php (1 hunks)
  • app-modules/user/src/Models/User.php (4 hunks)
  • app-modules/user/src/Plugins/AdminUserPanelPlugin.php (0 hunks)
  • app/Http/Middleware/GuestTenantIdentifier.php (2 hunks)
  • app/Providers/Filament/EventPanelProvider.php (2 hunks)
  • app/Providers/Filament/GuestPanelProvider.php (2 hunks)
  • bootstrap/providers.php (1 hunks)
  • config/he4rt.php (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@danielhe4rt danielhe4rt merged commit 404f1c4 into 3.x Nov 26, 2025
5 of 6 checks passed
@danielhe4rt danielhe4rt deleted the feat/event-tenant-domain branch November 26, 2025 15:43
This was referenced Nov 27, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Dec 8, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants