mirror of https://github.com/Lissy93/dashy.git
🛂 Adds access control checks in editor forms (#455)
This commit is contained in:
parent
69f709001f
commit
c8ad80b79c
|
@ -7,7 +7,7 @@
|
||||||
classes="dashy-modal edit-app-config"
|
classes="dashy-modal edit-app-config"
|
||||||
@closed="modalClosed"
|
@closed="modalClosed"
|
||||||
>
|
>
|
||||||
<div class="edit-app-config-inner">
|
<div class="edit-app-config-inner" v-if="allowViewConfig">
|
||||||
<h3>{{ $t('interactive-editor.menu.edit-app-config-btn') }}</h3>
|
<h3>{{ $t('interactive-editor.menu.edit-app-config-btn') }}</h3>
|
||||||
<!-- Show caution message -->
|
<!-- Show caution message -->
|
||||||
<div class="app-config-intro">
|
<div class="app-config-intro">
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
<!-- Save Button, lower -->
|
<!-- Save Button, lower -->
|
||||||
<SaveCancelButtons :saveClick="saveToState" :cancelClick="cancelEditing" />
|
<SaveCancelButtons :saveClick="saveToState" :cancelClick="cancelEditing" />
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ import FormSchema from '@formschema/native';
|
||||||
import DashySchema from '@/utils/ConfigSchema';
|
import DashySchema from '@/utils/ConfigSchema';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -58,6 +60,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
FormSchema,
|
FormSchema,
|
||||||
SaveCancelButtons,
|
SaveCancelButtons,
|
||||||
|
AccessError,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.formData = this.appConfig;
|
this.formData = this.appConfig;
|
||||||
|
@ -66,6 +69,9 @@ export default {
|
||||||
appConfig() {
|
appConfig() {
|
||||||
return this.$store.getters.appConfig;
|
return this.$store.getters.appConfig;
|
||||||
},
|
},
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* When form submitteed, update VueX store with new appConfig, and close modal */
|
/* When form submitteed, update VueX store with new appConfig, and close modal */
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
classes="dashy-modal edit-item"
|
classes="dashy-modal edit-item"
|
||||||
@closed="modalClosed"
|
@closed="modalClosed"
|
||||||
>
|
>
|
||||||
<div class="edit-item-inner">
|
<div class="edit-item-inner" v-if="allowViewConfig">
|
||||||
<!-- Title and Item ID -->
|
<!-- Title and Item ID -->
|
||||||
<h3 class="title">Edit Item</h3>
|
<h3 class="title">Edit Item</h3>
|
||||||
<p class="sub-title">Editing {{item.title}} (ID: {{itemId}})</p>
|
<p class="sub-title">Editing {{item.title}} (ID: {{itemId}})</p>
|
||||||
|
@ -67,6 +67,7 @@
|
||||||
<!-- Save to state button -->
|
<!-- Save to state button -->
|
||||||
<SaveCancelButtons :saveClick="saveItem" :cancelClick="modalClosed" />
|
<SaveCancelButtons :saveClick="saveItem" :cancelClick="modalClosed" />
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@
|
||||||
import AddIcon from '@/assets/interface-icons/interactive-editor-add.svg';
|
import AddIcon from '@/assets/interface-icons/interactive-editor-add.svg';
|
||||||
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
|
import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg';
|
||||||
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
import Input from '@/components/FormElements/Input';
|
import Input from '@/components/FormElements/Input';
|
||||||
import Radio from '@/components/FormElements/Radio';
|
import Radio from '@/components/FormElements/Radio';
|
||||||
import Select from '@/components/FormElements/Select';
|
import Select from '@/components/FormElements/Select';
|
||||||
|
@ -101,13 +103,18 @@ export default {
|
||||||
isNew: Boolean,
|
isNew: Boolean,
|
||||||
parentSectionTitle: String, // If adding new item, which section to add it under
|
parentSectionTitle: String, // If adding new item, which section to add it under
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
Input,
|
Input,
|
||||||
Radio,
|
Radio,
|
||||||
Select,
|
Select,
|
||||||
AddIcon,
|
AddIcon,
|
||||||
BinIcon,
|
BinIcon,
|
||||||
|
AccessError,
|
||||||
SaveCancelButtons,
|
SaveCancelButtons,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:resizable="true" width="50%" height="80%"
|
:resizable="true" width="50%" height="80%"
|
||||||
classes="dashy-modal edit-page-info"
|
classes="dashy-modal edit-page-info"
|
||||||
>
|
>
|
||||||
<div class="edit-page-info-inner">
|
<div class="edit-page-info-inner" v-if="allowViewConfig">
|
||||||
<h3>{{ $t('interactive-editor.menu.edit-page-info-btn') }}</h3>
|
<h3>{{ $t('interactive-editor.menu.edit-page-info-btn') }}</h3>
|
||||||
<FormSchema
|
<FormSchema
|
||||||
:schema="schema"
|
:schema="schema"
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
</Button>
|
</Button>
|
||||||
</FormSchema>
|
</FormSchema>
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import SaveIcon from '@/assets/interface-icons/save-config.svg';
|
import SaveIcon from '@/assets/interface-icons/save-config.svg';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditPageInfo',
|
name: 'EditPageInfo',
|
||||||
|
@ -43,6 +45,7 @@ export default {
|
||||||
FormSchema,
|
FormSchema,
|
||||||
Button,
|
Button,
|
||||||
SaveIcon,
|
SaveIcon,
|
||||||
|
AccessError,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.formData = this.pageInfo;
|
this.formData = this.pageInfo;
|
||||||
|
@ -51,6 +54,9 @@ export default {
|
||||||
pageInfo() {
|
pageInfo() {
|
||||||
return this.$store.getters.pageInfo;
|
return this.$store.getters.pageInfo;
|
||||||
},
|
},
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* When form submitteed, update VueX store with new pageInfo, and close modal */
|
/* When form submitteed, update VueX store with new pageInfo, and close modal */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:resizable="true" width="50%" height="80%"
|
:resizable="true" width="50%" height="80%"
|
||||||
classes="dashy-modal edit-section"
|
classes="dashy-modal edit-section"
|
||||||
>
|
>
|
||||||
<div class="edit-section-inner">
|
<div class="edit-section-inner" v-if="allowViewConfig">
|
||||||
<h3>
|
<h3>
|
||||||
{{ $t(`interactive-editor.edit-section.${isAddNew ? 'add' : 'edit'}-section-title`) }}
|
{{ $t(`interactive-editor.edit-section.${isAddNew ? 'add' : 'edit'}-section-title`) }}
|
||||||
</h3>
|
</h3>
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
:cancelClick="modalClosed"
|
:cancelClick="modalClosed"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ import StoreKeys from '@/utils/StoreMutations';
|
||||||
import DashySchema from '@/utils/ConfigSchema';
|
import DashySchema from '@/utils/ConfigSchema';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditSection',
|
name: 'EditSection',
|
||||||
|
@ -38,6 +40,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
SaveCancelButtons,
|
SaveCancelButtons,
|
||||||
FormSchema,
|
FormSchema,
|
||||||
|
AccessError,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -71,6 +74,9 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.sectionData = this.$store.getters.getSectionByIndex(this.sectionIndex);
|
this.sectionData = this.$store.getters.getSectionByIndex(this.sectionIndex);
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
:resizable="true"
|
:resizable="true"
|
||||||
width="50%"
|
width="50%"
|
||||||
height="80%"
|
height="80%"
|
||||||
classes="dashy-modal edit-item"
|
classes="dashy-modal export-modal"
|
||||||
@closed="modalClosed"
|
@closed="modalClosed"
|
||||||
>
|
>
|
||||||
<div class="export-config-inner">
|
<div class="export-config-inner" v-if="allowViewConfig">
|
||||||
<!-- Download and Copy to CLipboard Buttons -->
|
<!-- Download and Copy to CLipboard Buttons -->
|
||||||
<h3>{{ $t('interactive-editor.export.export-title') }}</h3>
|
<h3>{{ $t('interactive-editor.export.export-title') }}</h3>
|
||||||
<div class="download-button-container">
|
<div class="download-button-container">
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
<h3>{{ $t('interactive-editor.export.view-title') }}</h3>
|
<h3>{{ $t('interactive-editor.export.view-title') }}</h3>
|
||||||
<tree-view :data="config" class="config-tree-view" />
|
<tree-view :data="config" class="config-tree-view" />
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ import JsYaml from 'js-yaml';
|
||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
import DownloadConfigIcon from '@/assets/interface-icons/config-download-file.svg';
|
import DownloadConfigIcon from '@/assets/interface-icons/config-download-file.svg';
|
||||||
import CopyConfigIcon from '@/assets/interface-icons/interactive-editor-copy-clipboard.svg';
|
import CopyConfigIcon from '@/assets/interface-icons/interactive-editor-copy-clipboard.svg';
|
||||||
import { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
import { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
||||||
|
@ -42,6 +44,7 @@ export default {
|
||||||
name: 'ExportConfigMenu',
|
name: 'ExportConfigMenu',
|
||||||
components: {
|
components: {
|
||||||
Button,
|
Button,
|
||||||
|
AccessError,
|
||||||
CopyConfigIcon,
|
CopyConfigIcon,
|
||||||
DownloadConfigIcon,
|
DownloadConfigIcon,
|
||||||
},
|
},
|
||||||
|
@ -55,6 +58,9 @@ export default {
|
||||||
config() {
|
config() {
|
||||||
return this.$store.state.config;
|
return this.$store.state.config;
|
||||||
},
|
},
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
convertJsonToYaml() {
|
convertJsonToYaml() {
|
||||||
|
@ -123,5 +129,8 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.export-modal {
|
||||||
|
background: var(--interactive-editor-background);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<modal
|
<modal
|
||||||
:name="modalName" @closed="close"
|
:name="modalName" @closed="close"
|
||||||
:resizable="true" width="40%" height="40%" classes="dashy-modal">
|
:resizable="true" width="40%" height="40%" classes="dashy-modal">
|
||||||
<div class="move-menu-inner">
|
<div class="move-menu-inner" v-if="allowViewConfig">
|
||||||
<!-- Title and item ID -->
|
<!-- Title and item ID -->
|
||||||
<h3 class="move-title">Move or Copy Item</h3>
|
<h3 class="move-title">Move or Copy Item</h3>
|
||||||
<p class="item-id">Editing {{ itemId }}</p>
|
<p class="item-id">Editing {{ itemId }}</p>
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
<!-- Save and cancel buttons -->
|
<!-- Save and cancel buttons -->
|
||||||
<SaveCancelButtons :saveClick="save" :cancelClick="close" />
|
<SaveCancelButtons :saveClick="save" :cancelClick="close" />
|
||||||
</div>
|
</div>
|
||||||
|
<AccessError v-else />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
import Select from '@/components/FormElements/Select';
|
import Select from '@/components/FormElements/Select';
|
||||||
import Radio from '@/components/FormElements/Radio';
|
import Radio from '@/components/FormElements/Radio';
|
||||||
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
import SaveCancelButtons from '@/components/InteractiveEditor/SaveCancelButtons';
|
||||||
|
import AccessError from '@/components/Configuration/AccessError';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
|
|
||||||
|
@ -45,6 +47,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Select,
|
Select,
|
||||||
Radio,
|
Radio,
|
||||||
|
AccessError,
|
||||||
SaveCancelButtons,
|
SaveCancelButtons,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -83,6 +86,9 @@ export default {
|
||||||
});
|
});
|
||||||
return sectionName;
|
return sectionName;
|
||||||
},
|
},
|
||||||
|
allowViewConfig() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.selectedSection = this.currentSection;
|
this.selectedSection = this.currentSection;
|
||||||
|
|
Loading…
Reference in New Issue