@@ -96,6 +96,7 @@ export const DashboardLayout: FunctionComponent<PropsWithChildren<DashboardLayou
96
96
const [ announcement , setAnnouncement ] = useState < AnnouncementBannerInterface > ( ) ;
97
97
const [ showAnnouncement , setShowAnnouncement ] = useState < boolean > ( true ) ;
98
98
const [ dashboardLayoutRoutes , setDashboardLayoutRoutes ] = useState < RouteInterface [ ] > ( getDashboardLayoutRoutes ( ) ) ;
99
+ const allowedScopes : string = useSelector ( ( state : AppState ) => state ?. authenticationInformation ?. scope ) ;
99
100
100
101
useEffect ( ( ) => {
101
102
const localeCookie : string = CookieStorageUtils . getItem ( "ui_lang" ) ;
@@ -161,15 +162,24 @@ export const DashboardLayout: FunctionComponent<PropsWithChildren<DashboardLayou
161
162
}
162
163
163
164
const routes : RouteInterface [ ] = getDashboardLayoutRoutes ( ) . filter ( ( route : RouteInterface ) => {
164
- if ( route . path === AppConstants . getPaths ( ) . get ( "APPLICATIONS" ) && ! isApplicationsPageVisible ) {
165
- return false ;
165
+
166
+ if ( allowedScopes . includes ( "internal_user_impersonate" ) ) {
167
+ if ( route . path === "/" ) {
168
+ route . redirectTo = AppConstants . getPaths ( ) . get ( "APPLICATIONS" ) ;
169
+ } else if ( route . path != AppConstants . getPaths ( ) . get ( "APPLICATIONS" ) ) {
170
+ return false ;
171
+ }
172
+ } else {
173
+ if ( route . path === AppConstants . getPaths ( ) . get ( "APPLICATIONS" ) && ! isApplicationsPageVisible ) {
174
+ return false ;
175
+ }
166
176
}
167
177
168
178
return route ;
169
179
} ) ;
170
180
171
181
setDashboardLayoutRoutes ( filterRoutes ( routes , config . ui ?. features ) ) ;
172
- } , [ AppConstants . getTenantQualifiedAppBasename ( ) , config , isApplicationsPageVisible ] ) ;
182
+ } , [ AppConstants . getTenantQualifiedAppBasename ( ) , config , isApplicationsPageVisible , allowedScopes ] ) ;
173
183
174
184
/**
175
185
* On location change, update the selected route.
0 commit comments