mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 07:38:10 +00:00
feat(backoffice): guard routes and actions by permission
Mirrors the new keys in lib/permissions.ts, wraps the warehouse, overview, reports, support and booking-request routes in RequirePermission, and gates the dispatch, mark-paid, invoice pay/cancel, export and support-send actions behind their own keys. Removes duplicate route blocks.
This commit is contained in:
@@ -6,7 +6,32 @@ export const FREIGHT_PERMS = {
|
||||
view: "edr_freight_app:overview:view",
|
||||
},
|
||||
support: {
|
||||
view: "edr_freight_app:support:view",
|
||||
agentView: "edr_freight_app:support:agent_view",
|
||||
agentSend: "edr_freight_app:support:agent_send",
|
||||
},
|
||||
reports: {
|
||||
view: "edr_freight_app:reports:view",
|
||||
},
|
||||
procurement: {
|
||||
view: "edr_freight_app:procurement:view",
|
||||
vendorManage: "edr_freight_app:procurement:vendor_manage",
|
||||
acquisitionManage: "edr_freight_app:procurement:acquisition_manage",
|
||||
disposalManage: "edr_freight_app:procurement:disposal_manage",
|
||||
},
|
||||
compliance: {
|
||||
view: "edr_freight_app:compliance:view",
|
||||
manage: "edr_freight_app:compliance:manage",
|
||||
},
|
||||
facilities: {
|
||||
view: "edr_freight_app:facilities:view",
|
||||
manage: "edr_freight_app:facilities:manage",
|
||||
},
|
||||
tradeAccess: {
|
||||
view: "edr_freight_app:trade_access:view",
|
||||
manage: "edr_freight_app:trade_access:manage",
|
||||
},
|
||||
staffUsers: {
|
||||
view: "edr_freight_app:staff:users:view",
|
||||
},
|
||||
bookings: {
|
||||
view: "edr_freight_app:bookings:view",
|
||||
@@ -27,6 +52,7 @@ export const FREIGHT_PERMS = {
|
||||
uploadClearanceOutput: "edr_freight_app:bookings:upload_clearance_output",
|
||||
finalizeClearance: "edr_freight_app:bookings:finalize_clearance",
|
||||
docReviewAlert: "edr_freight_app:bookings:doc_review_alert",
|
||||
governmentExpedite: "edr_freight_app:bookings:government_expedite",
|
||||
},
|
||||
contracts: {
|
||||
view: "edr_freight_app:contracts:view",
|
||||
@@ -61,6 +87,9 @@ export const FREIGHT_PERMS = {
|
||||
clearanceEtActions: "edr_freight_app:contracts:clearance_et_actions",
|
||||
clearanceDjActions: "edr_freight_app:contracts:clearance_dj_actions",
|
||||
suspend: "edr_freight_app:contracts:suspend",
|
||||
editDocument: "edr_freight_app:contracts:edit_document",
|
||||
finalInvoiceRaise: "edr_freight_app:contracts:final_invoice_raise",
|
||||
finalInvoiceConfirm: "edr_freight_app:contracts:final_invoice_confirm",
|
||||
},
|
||||
trainScheduling: {
|
||||
view: "edr_freight_app:train_scheduling:view",
|
||||
@@ -69,6 +98,9 @@ export const FREIGHT_PERMS = {
|
||||
cancel: "edr_freight_app:train_scheduling:cancel",
|
||||
reschedule: "edr_freight_app:train_scheduling:reschedule",
|
||||
rulesManage: "edr_freight_app:train_scheduling:rules_manage",
|
||||
dispatch: "edr_freight_app:train_scheduling:dispatch",
|
||||
markPaid: "edr_freight_app:train_scheduling:mark_paid",
|
||||
expireBooking: "edr_freight_app:train_scheduling:expire_booking",
|
||||
},
|
||||
fleet: {
|
||||
view: "edr_freight_app:fleet:view",
|
||||
@@ -88,13 +120,9 @@ export const FREIGHT_PERMS = {
|
||||
},
|
||||
payments: {
|
||||
view: "edr_freight_app:payments:view",
|
||||
verify: "edr_freight_app:payments:verify",
|
||||
refund: "edr_freight_app:payments:refund",
|
||||
},
|
||||
invoices: {
|
||||
view: "edr_freight_app:invoices:view",
|
||||
create: "edr_freight_app:invoices:create",
|
||||
cancel: "edr_freight_app:invoices:cancel",
|
||||
export: "edr_freight_app:invoices:export",
|
||||
},
|
||||
firstMile: {
|
||||
@@ -191,14 +219,12 @@ export const FREIGHT_PERMS = {
|
||||
create: "edr_freight_app:fuel:create",
|
||||
update: "edr_freight_app:fuel:update",
|
||||
delete: "edr_freight_app:fuel:delete",
|
||||
approve: "edr_freight_app:fuel:approve",
|
||||
},
|
||||
maintenance: {
|
||||
view: "edr_freight_app:maintenance:view",
|
||||
create: "edr_freight_app:maintenance:create",
|
||||
update: "edr_freight_app:maintenance:update",
|
||||
delete: "edr_freight_app:maintenance:delete",
|
||||
complete: "edr_freight_app:maintenance:complete",
|
||||
},
|
||||
fleetReports: {
|
||||
view: "edr_freight_app:fleet_reports:view",
|
||||
@@ -278,6 +304,14 @@ export const FREIGHT_PERMS = {
|
||||
view: "edr_freight_app:settings:dropdown:view",
|
||||
manage: "edr_freight_app:settings:dropdown:manage",
|
||||
},
|
||||
exchangeRate: {
|
||||
view: "edr_freight_app:settings:exchange_rate:view",
|
||||
manage: "edr_freight_app:settings:exchange_rate:manage",
|
||||
},
|
||||
contractTemplates: {
|
||||
view: "edr_freight_app:settings:contract_templates:view",
|
||||
manage: "edr_freight_app:settings:contract_templates:manage",
|
||||
},
|
||||
},
|
||||
audit: {
|
||||
view: "edr_freight_app:audit:view",
|
||||
|
||||
Reference in New Issue
Block a user