Add permissions checking to the settings page

This commit is contained in:
Dane Everitt 2020-03-29 22:05:30 -07:00
parent 3df134b558
commit 79095b526c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -6,6 +6,7 @@ import { ApplicationStore } from '@/state';
import { UserData } from '@/state/user'; import { UserData } from '@/state/user';
import RenameServerBox from '@/components/server/settings/RenameServerBox'; import RenameServerBox from '@/components/server/settings/RenameServerBox';
import FlashMessageRender from '@/components/FlashMessageRender'; import FlashMessageRender from '@/components/FlashMessageRender';
import Can from '@/components/elements/Can';
export default () => { export default () => {
const user = useStoreState<ApplicationStore, UserData>(state => state.user.data!); const user = useStoreState<ApplicationStore, UserData>(state => state.user.data!);
@ -15,7 +16,8 @@ export default () => {
<div className={'my-10 mb-6'}> <div className={'my-10 mb-6'}>
<FlashMessageRender byKey={'settings'} className={'mb-4'}/> <FlashMessageRender byKey={'settings'} className={'mb-4'}/>
<div className={'md:flex'}> <div className={'md:flex'}>
<TitledGreyBox title={'SFTP Details'} className={'w-full md:flex-1 md:mr-6'}> <Can action={'file.sftp'}>
<TitledGreyBox title={'SFTP Details'} className={'w-full md:flex-1 md:max-w-1/2 md:mr-6'}>
<div> <div>
<label className={'input-dark-label'}>Server Address</label> <label className={'input-dark-label'}>Server Address</label>
<input <input
@ -52,9 +54,12 @@ export default () => {
</div> </div>
</div> </div>
</TitledGreyBox> </TitledGreyBox>
<div className={'w-full mt-6 md:flex-1 md:mt-0'}> </Can>
<Can action={'settings.rename'}>
<div className={'w-full mt-6 md:flex-1 md:max-w-1/2 md:mt-0'}>
<RenameServerBox/> <RenameServerBox/>
</div> </div>
</Can>
</div> </div>
</div> </div>
); );