Skip to content

[Bug] Admin panel is accessible by any authenticated user β€” no role checkΒ #69

@karastoyanov

Description

@karastoyanov

πŸ› Bug Description

The /admin route is wrapped in ProtectedRoute, which only checks if the user is logged in. Any authenticated user (regardless of their UserRole.role) can access the admin panel, create/edit/delete quests, and manage bosses.

πŸ“‹ Steps to Reproduce

  1. Register a regular user account
  2. Navigate to /admin

🎯 Expected Behavior

Only users with role == "Admin" can access /admin. Others get redirected to the home page (/dashboard).

πŸ“Έ Actual Behavior

Full admin panel is accessible to all logged-in users.

🌍 Environment

All environments.

πŸ“Ž Additional Context

App.jsx:40. UserRole model already has the role field (user_role.py:19). The /api/me response should include role, and ProtectedRoute (or a separate AdminRoute) should gate on it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions