Applied RBAC to compliance dashboard
This commit is contained in:
@@ -62,6 +62,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
|
|||||||
admin: ['unrestricted'],
|
admin: ['unrestricted'],
|
||||||
executive: [
|
executive: [
|
||||||
'dashboard',
|
'dashboard',
|
||||||
|
'compliance',
|
||||||
'governance',
|
'governance',
|
||||||
'projects_milestones',
|
'projects_milestones',
|
||||||
'grant_financials',
|
'grant_financials',
|
||||||
@@ -70,6 +71,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
|
|||||||
],
|
],
|
||||||
supervisor: [
|
supervisor: [
|
||||||
'dashboard',
|
'dashboard',
|
||||||
|
'compliance',
|
||||||
'projects_milestones',
|
'projects_milestones',
|
||||||
'grant_financials',
|
'grant_financials',
|
||||||
'evidence_risks',
|
'evidence_risks',
|
||||||
@@ -81,6 +83,7 @@ export const ROLE_CLAIM_MAP: Record<string, RoleClaim[]> = {
|
|||||||
],
|
],
|
||||||
manager: [
|
manager: [
|
||||||
'dashboard',
|
'dashboard',
|
||||||
|
'compliance',
|
||||||
'projects_milestones',
|
'projects_milestones',
|
||||||
'grant_financials',
|
'grant_financials',
|
||||||
'evidence_risks',
|
'evidence_risks',
|
||||||
@@ -393,6 +396,7 @@ export const ClaimProtectedRoute: React.FC<{
|
|||||||
if (!allowed) {
|
if (!allowed) {
|
||||||
let fallbackPath = '/dashboard';
|
let fallbackPath = '/dashboard';
|
||||||
if (canView('dashboard')) fallbackPath = '/dashboard';
|
if (canView('dashboard')) fallbackPath = '/dashboard';
|
||||||
|
else if (canView('compliance')) fallbackPath = '/compliance';
|
||||||
else if (canView('projects_milestones')) fallbackPath = '/projects';
|
else if (canView('projects_milestones')) fallbackPath = '/projects';
|
||||||
else if (canView('grant_financials')) fallbackPath = '/grants';
|
else if (canView('grant_financials')) fallbackPath = '/grants';
|
||||||
else if (canView('evidence_risks')) fallbackPath = '/monitoring';
|
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_ROLE_CLAIMS_PREFIX = 'pfm_cache_role_claims_';
|
||||||
export const LOCAL_STORAGE_SYSTEM_CLAIMS_KEY = 'pfm_cache_system_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 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.
|
* Invalidates and purges legacy cached claims if the schema version differs.
|
||||||
@@ -55,6 +55,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
|
|||||||
],
|
],
|
||||||
supervisor: [
|
supervisor: [
|
||||||
{ claimId: 20, claimType: 'dashboard', claimValue: 'view, export' },
|
{ 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: 21, claimType: 'projects_milestones', claimValue: 'view, add, update, export' },
|
||||||
{ claimId: 22, claimType: 'grant_financials', 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' },
|
{ claimId: 23, claimType: 'evidence_risks', claimValue: 'view, add, update, export' },
|
||||||
@@ -66,6 +67,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
|
|||||||
],
|
],
|
||||||
manager: [
|
manager: [
|
||||||
{ claimId: 10, claimType: 'dashboard', claimValue: 'all' },
|
{ claimId: 10, claimType: 'dashboard', claimValue: 'all' },
|
||||||
|
{ claimId: 39, claimType: 'compliance', claimValue: 'all' },
|
||||||
{ claimId: 11, claimType: 'projects_milestones', claimValue: 'all' },
|
{ claimId: 11, claimType: 'projects_milestones', claimValue: 'all' },
|
||||||
{ claimId: 12, claimType: 'grant_financials', claimValue: 'all' },
|
{ claimId: 12, claimType: 'grant_financials', claimValue: 'all' },
|
||||||
{ claimId: 13, claimType: 'evidence_risks', claimValue: 'all' },
|
{ claimId: 13, claimType: 'evidence_risks', claimValue: 'all' },
|
||||||
@@ -80,6 +82,7 @@ export const DEFAULT_ROLE_CLAIMS: Record<string, Claim[]> = {
|
|||||||
],
|
],
|
||||||
executive: [
|
executive: [
|
||||||
{ claimId: 1, claimType: 'dashboard', claimValue: 'all' },
|
{ claimId: 1, claimType: 'dashboard', claimValue: 'all' },
|
||||||
|
{ claimId: 40, claimType: 'compliance', claimValue: 'all' },
|
||||||
{ claimId: 2, claimType: 'governance', claimValue: 'all' },
|
{ claimId: 2, claimType: 'governance', claimValue: 'all' },
|
||||||
{ claimId: 3, claimType: 'projects_milestones', claimValue: 'all' },
|
{ claimId: 3, claimType: 'projects_milestones', claimValue: 'all' },
|
||||||
{ claimId: 4, claimType: 'grant_financials', claimValue: 'all' },
|
{ claimId: 4, claimType: 'grant_financials', claimValue: 'all' },
|
||||||
|
|||||||
Reference in New Issue
Block a user