Skip to content

Commit

Permalink
Implemented: support for the permission on the settings (hotwax#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 10, 2024
1 parent 793abd2 commit e479a4b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 202 deletions.
230 changes: 35 additions & 195 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/authorization/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
3 changes: 2 additions & 1 deletion src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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),
Expand All @@ -70,6 +71,7 @@ const app = createApp(App)
setUserLocale,
storeClientRegistrationToken,
getAvailableTimeZones,
hasPermission,
setUserTimeZone
});

Expand Down
8 changes: 4 additions & 4 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<ion-card-content>
{{ translate('View shipping orders along with pickup orders.') }}
</ion-card-content>
<ion-item lines="none">
<ion-item lines="none" :disabled="!hasPermission(Actions.APP_SETTING_UPDATE)">
<ion-toggle label-placement="start" :checked="getBopisProductStoreSettings('SHOW_SHIPPING_ORDERS')" @ionChange="setBopisProductStoreSettings($event, 'SHOW_SHIPPING_ORDERS')">{{ translate("Show shipping orders") }}</ion-toggle>
</ion-item>
</ion-card>
Expand All @@ -137,7 +137,7 @@
<ion-card-content>
{{ translate('Packing slips help customer reconcile their order against the delivered items.') }}
</ion-card-content>
<ion-item lines="none">
<ion-item lines="none" :disabled="!hasPermission(Actions.APP_SETTING_UPDATE)">
<ion-toggle label-placement="start" :checked="getBopisProductStoreSettings('PRINT_PACKING_SLIPS')" @ionChange="setBopisProductStoreSettings($event, 'PRINT_PACKING_SLIPS')">{{ translate("Generate packing slips") }}</ion-toggle>
</ion-item>
</ion-card>
Expand All @@ -151,10 +151,10 @@
<ion-card-content>
{{ translate('Track who picked orders by entering picker IDs when packing an order.') }}
</ion-card-content>
<ion-item>
<ion-item :disabled="!hasPermission(Actions.APP_SETTING_UPDATE)">
<ion-toggle label-placement="start" :checked="getBopisProductStoreSettings('ENABLE_TRACKING')" @ionChange="setBopisProductStoreSettings($event, 'ENABLE_TRACKING')">{{ translate("Enable tracking") }}</ion-toggle>
</ion-item>
<ion-item lines="none">
<ion-item lines="none" :disabled="!hasPermission(Actions.APP_SETTING_UPDATE)">
<ion-toggle label-placement="start" :checked="getBopisProductStoreSettings('PRINT_PICKLISTS')" @ionChange="setBopisProductStoreSettings($event, 'PRINT_PICKLISTS')">{{ translate("Print picklists") }}</ion-toggle>
</ion-item>
</ion-card>
Expand Down

0 comments on commit e479a4b

Please sign in to comment.