From f3c9f956739dcd270c14ad83c484fb53f34b5ebe Mon Sep 17 00:00:00 2001 From: root Date: Tue, 13 Aug 2024 19:49:14 -0400 Subject: [PATCH] #300 - hide Reports tap for non-root users --- .../df-side-nav/df-side-nav.component.ts | 17 ++++++- src/app/shared/utilities/route.ts | 51 ++++++++++++------- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/app/shared/components/df-side-nav/df-side-nav.component.ts b/src/app/shared/components/df-side-nav/df-side-nav.component.ts index 61f7d108..8f6a8da2 100644 --- a/src/app/shared/components/df-side-nav/df-side-nav.component.ts +++ b/src/app/shared/components/df-side-nav/df-side-nav.component.ts @@ -108,7 +108,22 @@ export class DfSideNavComponent implements OnInit { return of(null); } if (userData?.isSysAdmin && !userData.roleId) { - return of(null); + return of([ + 'home', + 'apps', + 'role', + 'users', + 'services', + 'apidocs', + 'schema/data', + 'files', + 'scripts', + 'systemInfo', + 'limits', + 'scheduler', + 'system-config', + 'admin-setting', + ]); } if (userData?.isSysAdmin && userData.roleId) { return this.userDataService.restrictedAccess$; diff --git a/src/app/shared/utilities/route.ts b/src/app/shared/utilities/route.ts index 489d2f19..642755b6 100644 --- a/src/app/shared/utilities/route.ts +++ b/src/app/shared/utilities/route.ts @@ -65,11 +65,8 @@ export function accessibleRoutes( const allowed: Array = [ROUTES.SYSTEM_INFO]; allowedTabs?.forEach(tab => { switch (tab) { - case 'apps': - allowed.push(ROUTES.API_KEYS); - break; - case 'users': - allowed.push(ROUTES.USERS); + case 'home': + allowed.push(ROUTES.HOME); break; case 'services': allowed.push( @@ -82,32 +79,48 @@ export function accessibleRoutes( ROUTES.DF_PLATFORM_APIS ); break; - case 'apidocs': - allowed.push(ROUTES.API_DOCS); - break; - case 'schema/data': - allowed.push(ROUTES.SCHEMA); + case 'role': + allowed.push(ROUTES.ROLE_BASED_ACCESS); break; - case 'files': - allowed.push(ROUTES.FILES); + case 'apps': + allowed.push(ROUTES.API_KEYS); break; case 'scripts': allowed.push(ROUTES.EVENT_SCRIPTS); break; - case 'config': - allowed.push( - ROUTES.CORS, - ROUTES.CACHE, - ROUTES.EMAIL_TEMPLATES, - ROUTES.GLOBAL_LOOKUP_KEYS - ); + case 'apidocs': + allowed.push(ROUTES.API_DOCS); break; case 'limits': allowed.push(ROUTES.RATE_LIMITING); break; + case 'system-config': + allowed.push(ROUTES.CORS); + allowed.push(ROUTES.CACHE); + allowed.push(ROUTES.EMAIL_TEMPLATES); + allowed.push(ROUTES.GLOBAL_LOOKUP_KEYS); + break; case 'scheduler': allowed.push(ROUTES.SCHEDULER); break; + case 'reports': + allowed.push(ROUTES.REPORTING); + break; + case 'users': + allowed.push(ROUTES.USERS); + break; + + case 'schema/data': + allowed.push(ROUTES.SCHEMA); + break; + case 'files': + allowed.push(ROUTES.FILES); + break; + + case 'admin-setting': + allowed.push(ROUTES.ADMINS); + allowed.push(ROUTES.LOGS); + break; } }); return navs.filter(nav => {