Applied RBAC to compliance dashboard

This commit is contained in:
2026-10-22 16:06:05 +02:00
parent efc63ca398
commit 3fda1ac5db
2 changed files with 8 additions and 1 deletions
@@ -62,6 +62,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
admin: ['unrestricted'],
executive: [
'dashboard',
'compliance',
'governance',
'projects_milestones',
'grant_financials',
@@ -70,6 +71,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
],
supervisor: [
'dashboard',
'compliance',
'projects_milestones',
'grant_financials',
'evidence_risks',
@@ -81,6 +83,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
],
manager: [
'dashboard',
'compliance',
'projects_milestones',
'grant_financials',
'evidence_risks',
@@ -393,6 +396,7 @@ export const ClaimProtectedRoute: React.FC<{
if (!allowed) {
let fallbackPath = '/dashboard';
if (canView('dashboard')) fallbackPath = '/dashboard';
else if (canView('compliance')) fallbackPath = '/compliance';
else if (canView('projects_milestones')) fallbackPath = '/projects';
else if (canView('grant_financials')) fallbackPath = '/grants';
else if (canView('evidence_risks')) fallbackPath = '/monitoring';
@@ -6,7 +6,7 @@ export const LOCAL_STORAGE_SYSTEM_ROLES_KEY = 'pfm_cache_system_roles';
export const LOCAL_STORAGE_ROLE_CLAIMS_PREFIX = 'pfm_cache_role_claims_';
export const LOCAL_STORAGE_SYSTEM_CLAIMS_KEY = 'pfm_cache_system_claims';
export const LOCAL_STORAGE_RBAC_VERSION_KEY = 'pfm_rbac_cache_version';
export const CURRENT_RBAC_CACHE_VERSION = 'v2.1';
export const CURRENT_RBAC_CACHE_VERSION = 'v2.2';
/**
* Invalidates and purges legacy cached claims if the schema version differs.
@@ -55,6 +55,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
],
supervisor: [
{ claimId: 20, claimType: 'dashboard', claimValue: 'view, export' },
{ claimId: 38, claimType: 'compliance', claimValue: 'view, export' },
{ claimId: 21, claimType: 'projects_milestones', claimValue: 'view, add, update, export' },
{ claimId: 22, claimType: 'grant_financials', claimValue: 'view, add, update, export' },
{ claimId: 23, claimType: 'evidence_risks', claimValue: 'view, add, update, export' },
@@ -66,6 +67,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
],
manager: [
{ claimId: 10, claimType: 'dashboard', claimValue: 'all' },
{ claimId: 39, claimType: 'compliance', claimValue: 'all' },
{ claimId: 11, claimType: 'projects_milestones', claimValue: 'all' },
{ claimId: 12, claimType: 'grant_financials', claimValue: 'all' },
{ claimId: 13, claimType: 'evidence_risks', claimValue: 'all' },
@@ -80,6 +82,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
],
executive: [
{ claimId: 1, claimType: 'dashboard', claimValue: 'all' },
{ claimId: 40, claimType: 'compliance', claimValue: 'all' },
{ claimId: 2, claimType: 'governance', claimValue: 'all' },
{ claimId: 3, claimType: 'projects_milestones', claimValue: 'all' },
{ claimId: 4, claimType: 'grant_financials', claimValue: 'all' },