diff --git a/src/components/Settings/SettingsCard.vue b/src/components/Settings/SettingsCard.vue index def1884..e5bf176 100644 --- a/src/components/Settings/SettingsCard.vue +++ b/src/components/Settings/SettingsCard.vue @@ -15,7 +15,6 @@ export default { props: { item: Object } - } diff --git a/src/components/Settings/SettingsHome.vue b/src/components/Settings/SettingsHome.vue index b9d89c1..7c25fae 100644 --- a/src/components/Settings/SettingsHome.vue +++ b/src/components/Settings/SettingsHome.vue @@ -19,7 +19,7 @@ import { storeToRefs } from "pinia" export default { setup() { const acquisitionsStore = inject("acquisitionsStore") - const { convertSettingsToObject } = acquisitionsStore + const { convertSettingsToObject, isUserPermitted } = acquisitionsStore const { settings, } = storeToRefs(acquisitionsStore) @@ -27,6 +27,7 @@ export default { return { settings, convertSettingsToObject, + isUserPermitted, settingsJSON } }, @@ -66,6 +67,20 @@ export default { modulesEnabled.push('tasks') const modules = Object.keys(settingsJSON) + if(!this.isUserPermitted('manage_settings')) { + const moduleData = settingsJSON.manual + this.navPanes = [ + { + path: "/acquisitions/settings/manual", + icon: moduleData.icon, + title: moduleData.title, + module: 'Manual' + } + ] + this.initialised = true + return + } + const navPanes = modules.map(moduleName => { const moduleData = settingsJSON[moduleName] return { @@ -75,6 +90,7 @@ export default { module: moduleName } }).filter(m => modulesEnabled.includes(m.module)) + this.navPanes = navPanes this.initialised = true return navPanes diff --git a/src/data/permissionsMatrix.js b/src/data/permissionsMatrix.js index 4e485d8..fb9c870 100644 --- a/src/data/permissionsMatrix.js +++ b/src/data/permissionsMatrix.js @@ -1,4 +1,5 @@ export const permissionsMatrix = { + manage_settings: ['manage_sysprefs'], add_task: [], edit_task: [], delete_task: [], diff --git a/src/routes/routes.js b/src/routes/routes.js index 5031f6b..dd0b912 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -238,6 +238,7 @@ export const routes = [ name: "ModuleSettingsGeneral", title: "General", is_navigation_item: false, + permission: "manage_settings" }, { path: "tasks", @@ -245,6 +246,7 @@ export const routes = [ name: "ModuleSettingsTasks", title: "Tasks", is_navigation_item: false, + permission: "manage_settings" }, { path: "funds", @@ -252,6 +254,7 @@ export const routes = [ name: "ModuleSettingsFunds", title: "Funds", is_navigation_item: false, + permission: "manage_settings" }, { path: "manual", diff --git a/src/stores/acquisitions.js b/src/stores/acquisitions.js index 71081fc..6db1eb4 100644 --- a/src/stores/acquisitions.js +++ b/src/stores/acquisitions.js @@ -96,7 +96,17 @@ export const useAcquisitionsStore = defineStore("acquisitions", { if(!operation) return true if(this.permissions_matrix[operation].length === 0) return true - const { acquisition, superlibrarian } = userflags + const { acquisition, parameters, superlibrarian } = userflags + if(operation === 'manage_settings') { + let checkResult = false + if( superlibrarian || parameters === 1 || parameters.manage_sysprefs) { + checkResult = true + } else { + checkResult = false + } + return checkResult + } + if (acquisition === 1 || superlibrarian) { return true } else {