feat(admin): restrict admin access and enhance navigation for superadmins
Deploy Development / deploy (push) Successful in 37s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 8s
Test Suite / playwright-tests (push) Successful in 23s
Test Suite / pytest-backend (pull_request) Successful in 24s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 7s
Test Suite / playwright-tests (pull_request) Successful in 24s
Deploy Development / deploy (push) Successful in 37s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 8s
Test Suite / playwright-tests (push) Successful in 23s
Test Suite / pytest-backend (pull_request) Successful in 24s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 7s
Test Suite / playwright-tests (pull_request) Successful in 24s
- Updated access control to ensure only superadmins can view admin routes and manage users. - Refactored navigation components to reflect the new role-based access, removing platform admin references. - Enhanced the admin user management page to streamline functionality for superadmins, including password reset options. - Improved overall user experience by clarifying navigation paths and access permissions for different user roles.
This commit is contained in:
1 parent
30c1c259d2
commit
01be9ffcd4
8 files changed
+267
-427
No files matched your search
@@ -3,6 +3,6 @@ import { useAuth } from '../context/AuthContext'
|
||||
|
||||
export default function AdminHomeRedirect() {
|
||||
const { user } = useAuth()
|
||||
const isPlat = user?.role === 'admin' || user?.role === 'superadmin'
|
||||
return <Navigate to={isPlat ? '/admin/hierarchy' : '/admin/users'} replace />
|
||||
const isSuper = user?.role === 'superadmin'
|
||||
return <Navigate to={isSuper ? '/admin/hierarchy' : '/'} replace />
|
||||
}
|
||||
@@ -2,19 +2,16 @@ import { NavLink } from 'react-router-dom'
|
||||
import { TreePine, FolderTree, Download, Grid3x3, Users } from 'lucide-react'
|
||||
|
||||
/**
|
||||
* Admin-Seiten-Navigation (horizontal)
|
||||
* Nutzer-Verwaltung: eingeschränkte Tabs für Vereinsorga ohne Plattform-Admin.
|
||||
* Admin-Seiten-Navigation (horizontal) — nur für Super-Admins (globaler Portal-Mandant).
|
||||
*/
|
||||
export default function AdminPageNav({ clubOrgOnly = false }) {
|
||||
const pages = clubOrgOnly
|
||||
? [{ to: '/admin/users', label: 'Nutzer', icon: Users }]
|
||||
: [
|
||||
{ to: '/admin/hierarchy', label: 'Hierarchie', icon: TreePine },
|
||||
{ to: '/admin/users', label: 'Nutzer', icon: Users },
|
||||
{ to: '/admin/maturity-models', label: 'Fähigkeitsmatrix', icon: Grid3x3 },
|
||||
{ to: '/admin/catalogs', label: 'Kataloge', icon: FolderTree },
|
||||
{ to: '/admin/mediawiki-import', label: 'Wiki-Import', icon: Download },
|
||||
]
|
||||
export default function AdminPageNav() {
|
||||
const pages = [
|
||||
{ to: '/admin/hierarchy', label: 'Hierarchie', icon: TreePine },
|
||||
{ to: '/admin/users', label: 'Nutzer', icon: Users },
|
||||
{ to: '/admin/maturity-models', label: 'Fähigkeitsmatrix', icon: Grid3x3 },
|
||||
{ to: '/admin/catalogs', label: 'Kataloge', icon: FolderTree },
|
||||
{ to: '/admin/mediawiki-import', label: 'Wiki-Import', icon: Download },
|
||||
]
|
||||
|
||||
return (
|
||||
<nav className="admin-top-nav" aria-label="Administration">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Navigate } from 'react-router-dom'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
|
||||
/** Nur Plattform-Admins (admin/superadmin); Vereinsorga → /admin/users */
|
||||
/** Nur Super-Admins; andere Nutzer → Startseite. */
|
||||
export default function PlatformAdminRoute({ children }) {
|
||||
const { user } = useAuth()
|
||||
const ok = user?.role === 'admin' || user?.role === 'superadmin'
|
||||
if (!ok) return <Navigate to="/admin/users" replace />
|
||||
const ok = user?.role === 'superadmin'
|
||||
if (!ok) return <Navigate to="/" replace />
|
||||
return children
|
||||
}
|
||||
Reference in new issue
Block a user