Super Admin Role & Auth System #124

Open
opened 2026-07-09 14:23:10 +00:00 by NW · 0 comments
Owner

Overview

Implement super admin role differentiation in the web admin panel. Currently the admin panel treats all logged-in users equally. We need:

Requirements

  1. Role-based access in admin panel: Distinguish between admin and super_admin roles in the web panel
  2. Super admin middleware for web routes: Add requireSuperAuth middleware for sensitive routes (seed phrase viewing, commission management)
  3. Session role tracking: Store role in the auth token payload (admin vs super_admin)
  4. Visual role indicator: Show role badge in the admin panel header/sidebar
  5. Super admin exclusive menu items: Seed Viewer, Commission Dashboard only visible to super admins

Acceptance Criteria

  • Auth token includes role field
  • requireSuperAuth middleware blocks non-super-admin users
  • Sidebar shows role badge next to username
  • Super admin-only menu items are hidden for regular admins
  • All existing admin functionality still works for both roles

Technical Notes

  • Current auth: src/admin/auth.js uses ADMIN_SECRET env var
  • Current role check: src/middleware/auth.js has isSuperAdmin() for Telegram
  • Need to extend web auth to check SUPER_ADMIN_IDS against telegram_id or a new admin_users table
  • Consider adding admin_users table with role field for web panel access control
## Overview Implement super admin role differentiation in the web admin panel. Currently the admin panel treats all logged-in users equally. We need: ## Requirements 1. **Role-based access in admin panel**: Distinguish between admin and super_admin roles in the web panel 2. **Super admin middleware for web routes**: Add requireSuperAuth middleware for sensitive routes (seed phrase viewing, commission management) 3. **Session role tracking**: Store role in the auth token payload (admin vs super_admin) 4. **Visual role indicator**: Show role badge in the admin panel header/sidebar 5. **Super admin exclusive menu items**: Seed Viewer, Commission Dashboard only visible to super admins ## Acceptance Criteria - [ ] Auth token includes role field - [ ] requireSuperAuth middleware blocks non-super-admin users - [ ] Sidebar shows role badge next to username - [ ] Super admin-only menu items are hidden for regular admins - [ ] All existing admin functionality still works for both roles ## Technical Notes - Current auth: src/admin/auth.js uses ADMIN_SECRET env var - Current role check: src/middleware/auth.js has isSuperAdmin() for Telegram - Need to extend web auth to check SUPER_ADMIN_IDS against telegram_id or a new admin_users table - Consider adding admin_users table with role field for web panel access control
NW added this to the Super Admin Panel & Product Evolution milestone 2026-07-09 14:23:10 +00:00
Sign in to join this conversation.