Add basic permissions checking logic to frontend

This commit is contained in:
Dane Everitt 2020-03-28 17:25:04 -07:00
parent 7e0ac2c311
commit ab4c4e7e9e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 81 additions and 11 deletions

View file

@ -15,6 +15,7 @@ import SettingsContainer from '@/components/server/settings/SettingsContainer';
import ScheduleContainer from '@/components/server/schedules/ScheduleContainer';
import ScheduleEditContainer from '@/components/server/schedules/ScheduleEditContainer';
import UsersContainer from '@/components/server/users/UsersContainer';
import Can from '@/components/elements/Can';
const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => {
const server = ServerContext.useStoreState(state => state.server.data);
@ -34,11 +35,21 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<div id={'sub-navigation'}>
<div className={'items'}>
<NavLink to={`${match.url}`} exact>Console</NavLink>
<NavLink to={`${match.url}/files`}>File Manager</NavLink>
<NavLink to={`${match.url}/databases`}>Databases</NavLink>
<NavLink to={`${match.url}/schedules`}>Schedules</NavLink>
<NavLink to={`${match.url}/users`}>Users</NavLink>
<NavLink to={`${match.url}/settings`}>Settings</NavLink>
<Can action={'file.*'}>
<NavLink to={`${match.url}/files`}>File Manager</NavLink>
</Can>
<Can action={'database.*'}>
<NavLink to={`${match.url}/databases`}>Databases</NavLink>
</Can>
<Can action={'schedule.*'}>
<NavLink to={`${match.url}/schedules`}>Schedules</NavLink>
</Can>
<Can action={'user.*'}>
<NavLink to={`${match.url}/users`}>Users</NavLink>
</Can>
<Can action={'settings.*'}>
<NavLink to={`${match.url}/settings`}>Settings</NavLink>
</Can>
</div>
</div>
</CSSTransition>