Skip to content

feat: add configurable Horizon dashboard admin access#9353

Closed
SelimSalihovic wants to merge 1 commit intocoollabsio:nextfrom
SelimSalihovic:feature/horizon-configurable-admin-access
Closed

feat: add configurable Horizon dashboard admin access#9353
SelimSalihovic wants to merge 1 commit intocoollabsio:nextfrom
SelimSalihovic:feature/horizon-configurable-admin-access

Conversation

@SelimSalihovic
Copy link
Copy Markdown

Related Issue

Fixes #9351

Description

Adds support for HORIZON_ALLOWED_EMAILS environment variable to grant additional users access to the Horizon dashboard (/horizon). Currently, only the root user (User ID 0) can access Horizon, which limits monitoring capabilities in multi-admin team environments.

Changes Made

  • Modified HorizonServiceProvider::gate() to check HORIZON_ALLOWED_EMAILS environment variable
  • Accepts comma-separated list of email addresses
  • Root user (User ID 0) always retains access (backward compatible)
  • Added documentation to .env.development.example with usage examples
  • Empty/whitespace values are filtered out automatically

Why This Is Needed

In production environments with multiple team administrators, restricting Horizon access to only the root user creates operational bottlenecks. DevOps team members need visibility into queue health, job failures, and worker performance without requiring root user credentials.

How to Test

  1. Start development environment:

    spin up
  2. Add additional admin emails to .env:

    HORIZON_ALLOWED_EMAILS=admin@example.com,devops@example.com
  3. Restart Horizon:

    docker exec coolify php artisan horizon:terminate
  4. Test access scenarios:

    • Login as root user → Access /horizon → Should work ✅
    • Login as user in HORIZON_ALLOWED_EMAILS → Access /horizon → Should work ✅
    • Login as any other user → Access /horizon → Should get 403 Forbidden ✅
    • Remove env var → Only root user should have access ✅

Breaking Changes

None. This change is fully backward compatible. Without the HORIZON_ALLOWED_EMAILS environment variable, behavior remains unchanged (only root user has access).

Contributor Agreement

  • I understand and agree that my contribution will be subject to the project's license
  • I have tested these changes locally
  • I understand the changes I am making

Add support for HORIZON_ALLOWED_EMAILS environment variable to grant
additional users access to the Horizon dashboard (/horizon).

Changes:
- Modified HorizonServiceProvider gate to check HORIZON_ALLOWED_EMAILS
- Accepts comma-separated list of email addresses
- Root user (User ID 0) always retains access
- Added documentation to .env.development.example
- Backward compatible (works without the env var)

This allows team members to access Horizon monitoring without needing
to be the root user, useful in multi-admin environments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know.

@github-actions github-actions bot closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant