From e479a4b631b8913a468dffbe1237fd062766002d Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 10 Oct 2024 12:51:13 +0530 Subject: [PATCH] Implemented: support for the permission on the settings (#443) --- package-lock.json | 230 ++++++----------------------------- package.json | 2 +- src/authorization/Actions.ts | 1 + src/authorization/Rules.ts | 3 +- src/main.ts | 4 +- src/views/Settings.vue | 8 +- 6 files changed, 46 insertions(+), 202 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c0b5a29f..30213bb9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", + "@hotwax/dxp-components": "file:../dxp-components", "@hotwax/oms-api": "^1.14.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", @@ -53,6 +53,38 @@ "typescript": "~4.7.4" } }, + "../dxp-components": { + "version": "1.15.3", + "license": "Apache-2.0", + "dependencies": { + "@hotwax/oms-api": "^1.8.1", + "@ionic/core": "^7.6.0", + "@ionic/vue": "^7.6.0", + "firebase": "^10.3.1", + "luxon": "^3.3.0", + "pinia": "2.0.36", + "pinia-plugin-persistedstate": "^3.1.0", + "register-service-worker": "^1.7.2", + "vue": "^3.3.4", + "vue-i18n": "^9.2.2", + "vue-markdown-render": "^2.2.1" + }, + "devDependencies": { + "@babel/types": "^7.22.11", + "@types/luxon": "^3.3.0", + "@types/node": "^20.5.7", + "@vitejs/plugin-vue": "^4.3.4", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^11.0.3", + "@vue/tsconfig": "^0.1.3", + "eslint": "^8.48.0", + "eslint-plugin-vue": "^9.17.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "~4.7.4", + "vite": "^4.4.9", + "vue-tsc": "^1.8.8" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -2807,80 +2839,8 @@ "integrity": "sha512-zpUjGoY7LBlKeiP0V7tonrmoey8HQ5THQmyixQ+IDtrjmEJNBjynW/Ef3gC0FUNNPuVqxWPZdT5CVgaETLGTwg==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.2.tgz", - "integrity": "sha512-0jF1xkRIVrDbJwUaaPwWUhp3cVBpdjgAJO/fOQ4XYjzKb8rYXgw0Xm/qHHUnSeAZW5laMnQrm1KtPZp8szu4dQ==", - "dependencies": { - "@hotwax/oms-api": "^1.8.1", - "@ionic/core": "^7.6.0", - "@ionic/vue": "^7.6.0", - "firebase": "^10.3.1", - "luxon": "^3.3.0", - "pinia": "2.0.36", - "pinia-plugin-persistedstate": "^3.1.0", - "register-service-worker": "^1.7.2", - "vue": "^3.3.4", - "vue-i18n": "^9.2.2", - "vue-markdown-render": "^2.2.1" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.36.tgz", - "integrity": "sha512-4UKApwjlmJH+VuHKgA+zQMddcCb3ezYnyewQ9NVrsDqZ/j9dMv5+rh+1r48whKNdpFkZAWVxhBp5ewYaYX9JcQ==", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.2.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia-plugin-persistedstate": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz", - "integrity": "sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==", - "peerDependencies": { - "pinia": "^2.0.0" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia/node_modules/vue-demi": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", - "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } + "resolved": "../dxp-components", + "link": true }, "node_modules/@hotwax/oms-api": { "version": "1.14.0", @@ -2916,47 +2876,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@intlify/core-base": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.10.2.tgz", - "integrity": "sha512-HGStVnKobsJL0DoYIyRCGXBH63DMQqEZxDUGrkNI05FuTcruYUtOAxyL3zoAZu/uDGO6mcUvm3VXBaHG2GdZCg==", - "dependencies": { - "@intlify/message-compiler": "9.10.2", - "@intlify/shared": "9.10.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/message-compiler": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.10.2.tgz", - "integrity": "sha512-ntY/kfBwQRtX5Zh6wL8cSATujPzWW2ZQd1QwKyWwAy5fMqJyyixHMeovN4fmEyCqSu+hFfYOE63nU94evsy4YA==", - "dependencies": { - "@intlify/shared": "9.10.2", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/shared": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.10.2.tgz", - "integrity": "sha512-ttHCAJkRy7R5W2S9RVnN9KYQYPIpV2+GiS79T4EE37nrPyH6/1SrOh3bmdCRC1T3ocL8qCDx7x2lBJ0xaITU7Q==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, "node_modules/@ionic/core": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.8.5.tgz", @@ -11362,14 +11281,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/linkify-it": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", - "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/listr2": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", @@ -11796,37 +11707,6 @@ "semver": "bin/semver.js" } }, - "node_modules/markdown-it": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", - "integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", - "dependencies": { - "argparse": "^2.0.1", - "entities": "~3.0.1", - "linkify-it": "^4.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/markdown-it/node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/md5": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", @@ -11843,11 +11723,6 @@ "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "dev": true }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -15861,11 +15736,6 @@ "node": ">=4.2.0" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -16246,25 +16116,6 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, - "node_modules/vue-i18n": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.10.2.tgz", - "integrity": "sha512-ECJ8RIFd+3c1d3m1pctQ6ywG5Yj8Efy1oYoAKQ9neRdkLbuKLVeW4gaY5HPkD/9ssf1pOnUrmIFjx2/gkGxmEw==", - "dependencies": { - "@intlify/core-base": "9.10.2", - "@intlify/shared": "9.10.2", - "@vue/devtools-api": "^6.5.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - }, - "peerDependencies": { - "vue": "^3.0.0" - } - }, "node_modules/vue-loader": { "version": "17.3.1", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.3.1.tgz", @@ -16362,17 +16213,6 @@ "resolved": "https://registry.npmjs.org/vue-logger-plugin/-/vue-logger-plugin-2.2.3.tgz", "integrity": "sha512-PGGwFarWpReyJc8XONuNBb86mpfLqYO6+MWjkFnCDWcagjM2BLY7rskLTgn3eT3skq0qu+2K2roiIAgiXJDXSQ==" }, - "node_modules/vue-markdown-render": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vue-markdown-render/-/vue-markdown-render-2.2.1.tgz", - "integrity": "sha512-XkYnC0PMdbs6Vy6j/gZXSvCuOS0787Se5COwXlepRqiqPiunyCIeTPQAO2XnB4Yl04EOHXwLx5y6IuszMWSgyQ==", - "dependencies": { - "markdown-it": "^13.0.2" - }, - "peerDependencies": { - "vue": "^3.3.4" - } - }, "node_modules/vue-router": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.5.tgz", diff --git a/package.json b/package.json index 39d6fc1d0..6d4c6c099 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", + "@hotwax/dxp-components": "file:../dxp-components", "@hotwax/oms-api": "^1.14.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", diff --git a/src/authorization/Actions.ts b/src/authorization/Actions.ts index bba9872c3..26aa49d32 100644 --- a/src/authorization/Actions.ts +++ b/src/authorization/Actions.ts @@ -3,4 +3,5 @@ export default { 'APP_REJECT_ORDER': 'APP_REJECT_ORDER', 'APP_RF_CONFIG_UPDATE': 'APP_RF_CONFIG_UPDATE', 'APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE': 'APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE', + 'APP_SETTING_UPDATE': 'APP_SETTING_UPDATE' } \ No newline at end of file diff --git a/src/authorization/Rules.ts b/src/authorization/Rules.ts index 2409983de..51163b0fe 100644 --- a/src/authorization/Rules.ts +++ b/src/authorization/Rules.ts @@ -7,5 +7,6 @@ export default { "APP_ORDER_UPDATE": "", "APP_RF_CONFIG_UPDATE": "COMMON_ADMIN", "APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "COMMON_ADMIN", - "APP_STOREFULFILLMENT_ADMIN": "STOREFULFILLMENT_ADMIN" + "APP_STOREFULFILLMENT_ADMIN": "STOREFULFILLMENT_ADMIN", + "APP_SETTING_UPDATE": "COMMON_ADMIN" } as any \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ac45a9496..2860cc564 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,7 @@ import "@hotwax/apps-theme"; import store from './store' -import permissionPlugin from '@/authorization'; +import permissionPlugin, { Actions, hasPermission } from '@/authorization'; import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; @@ -54,6 +54,7 @@ const app = createApp(App) actions: permissionActions }) .use(dxpComponents, { + Actions, addNotification, appLoginUrl: process.env.VUE_APP_LOGIN_URL as string, appFirebaseConfig: JSON.parse(process.env.VUE_APP_FIREBASE_CONFIG), @@ -70,6 +71,7 @@ const app = createApp(App) setUserLocale, storeClientRegistrationToken, getAvailableTimeZones, + hasPermission, setUserTimeZone }); diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 997d9f985..a69e32751 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -123,7 +123,7 @@ {{ translate('View shipping orders along with pickup orders.') }} - + {{ translate("Show shipping orders") }} @@ -137,7 +137,7 @@ {{ translate('Packing slips help customer reconcile their order against the delivered items.') }} - + {{ translate("Generate packing slips") }} @@ -151,10 +151,10 @@ {{ translate('Track who picked orders by entering picker IDs when packing an order.') }} - + {{ translate("Enable tracking") }} - + {{ translate("Print picklists") }}