feat: add IAM_ADMIN_PERMISSIONS for user management access control

This commit is contained in:
Nati
2026-08-13 14:01:57 +00:00
parent 6852fc86c6
commit a148c00792
4 changed files with 32 additions and 3 deletions

View File

@@ -26,7 +26,13 @@ import {
IconUserShield,
} from '@tabler/icons-react';
import type { NavSection } from '@ema-platform/ui';
import { LICENSE_PERMISSIONS as P } from '@ema-platform/auth';
import {
IAM_ADMIN_PERMISSIONS,
LICENSE_PERMISSIONS as P,
} from '@ema-platform/auth';
/** Any user-administration duty opens the embedded User Management module. */
export const UM_PERMISSIONS = Object.values(IAM_ADMIN_PERMISSIONS);
/**
* Every licence-type queue and its review workspace share one gate: the
@@ -143,7 +149,12 @@ export const NAV_SECTIONS: NavSection[] = [
{
label: 'nav.groupAdministration',
items: [
{ to: '/um/user-management/dashboard', label: 'nav.userManagement', icon: IconUserShield },
{
to: '/um/user-management/dashboard',
label: 'nav.userManagement',
icon: IconUserShield,
permissions: UM_PERMISSIONS,
},
{
// Professions, locations and certifications have no dedicated keys;
// the config-view keys are the closest published contract.

View File

@@ -14,6 +14,7 @@ import {
} from '@ema-platform/auth';
import { AuthLayout } from '../layouts/AuthLayout';
import { BackofficeLayout } from '../layouts/BackofficeLayout';
import { UM_PERMISSIONS } from '../layouts/nav-config';
import { ProtectedRoute } from './ProtectedRoute';
import { DashboardPage } from '../features/dashboard/pages/DashboardPage';
import UserManagementPage from '../features/user-management/UserManagementPage';
@@ -60,7 +61,10 @@ const router = createBrowserRouter([
{ path: '/otp-verify', element: <OTPVerificationPage /> },
],
},
{ path: '/um/*', element: <UserManagementPage /> },
{
path: '/um/*',
element: guard(UM_PERMISSIONS, <UserManagementPage />),
},
{ path: '/', element: <Navigate to="/dashboard" replace /> },
{ path: '/profile-setup', element: <Navigate to="/dashboard" replace /> },
{