@@ -28,6 +28,7 @@ import SubNavigation from '@/components/elements/SubNavigation';
2828import NetworkContainer from '@/components/server/network/NetworkContainer' ;
2929import InstallListener from '@/components/server/InstallListener' ;
3030import StartupContainer from '@/components/server/startup/StartupContainer' ;
31+ import requireServerPermission from '@/hoc/requireServerPermission' ;
3132
3233const ServerRouter = ( { match, location } : RouteComponentProps < { id : string } > ) => {
3334 const { rootAdmin } = useStoreState ( state => state . user . data ! ) ;
@@ -121,7 +122,11 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
121122 < TransitionRouter >
122123 < Switch location = { location } >
123124 < Route path = { `${ match . path } ` } component = { ServerConsole } exact />
124- < Route path = { `${ match . path } /files` } component = { FileManagerContainer } exact />
125+ < Route
126+ path = { `${ match . path } /files` }
127+ component = { requireServerPermission ( FileManagerContainer , 'file.*' ) }
128+ exact
129+ />
125130 < Route
126131 path = { `${ match . path } /files/:action(edit|new)` }
127132 render = { props => (
@@ -131,17 +136,17 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
131136 ) }
132137 exact
133138 />
134- < Route path = { `${ match . path } /databases` } component = { DatabasesContainer } exact />
135- < Route path = { `${ match . path } /schedules` } component = { ScheduleContainer } exact />
139+ < Route path = { `${ match . path } /databases` } component = { requireServerPermission ( DatabasesContainer , 'database.*' ) } exact />
140+ < Route path = { `${ match . path } /schedules` } component = { requireServerPermission ( ScheduleContainer , 'schedule.*' ) } exact />
136141 < Route
137142 path = { `${ match . path } /schedules/:id` }
138143 component = { ScheduleEditContainer }
139144 exact
140145 />
141- < Route path = { `${ match . path } /users` } component = { UsersContainer } exact />
142- < Route path = { `${ match . path } /backups` } component = { BackupContainer } exact />
143- < Route path = { `${ match . path } /network` } component = { NetworkContainer } exact />
144- < Route path = { `${ match . path } /startup` } component = { StartupContainer } exact />
146+ < Route path = { `${ match . path } /users` } component = { requireServerPermission ( UsersContainer , 'user.*' ) } exact />
147+ < Route path = { `${ match . path } /backups` } component = { requireServerPermission ( BackupContainer , 'backup.*' ) } exact />
148+ < Route path = { `${ match . path } /network` } component = { requireServerPermission ( NetworkContainer , 'allocation.*' ) } exact />
149+ < Route path = { `${ match . path } /startup` } component = { requireServerPermission ( StartupContainer , 'startup.*' ) } exact />
145150 < Route path = { `${ match . path } /settings` } component = { SettingsContainer } exact />
146151 < Route path = { '*' } component = { NotFound } />
147152 </ Switch >
0 commit comments