mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 16:35:42 +00:00
fix(freight:backoffice): wire dedicated permission keys instead of broad fallbacks
Compliance & Alerts, Procurement, File settings, Dropdown settings, Trade access, and Exchange rate all fell back to a broad permission (fleet:view or admin) even though a dedicated key already existed in FREIGHT_PERMS — meaning granting one of these pages meant granting several unrelated ones too. Each now checks its own key first, with the broad permission kept as a fallback for existing role grants. Incidents left as-is: no dedicated edr_freight_app:incidents:* key exists yet on the backend. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -764,7 +764,9 @@ const App = () => {
|
||||
<Route
|
||||
path="compliance"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.fleet.view}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.compliance.view, FREIGHT_PERMS.fleet.view]}
|
||||
>
|
||||
<CompliancePage />
|
||||
</RequirePermission>
|
||||
}
|
||||
@@ -788,7 +790,9 @@ const App = () => {
|
||||
<Route
|
||||
path="procurement"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.fleet.view}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.procurement.view, FREIGHT_PERMS.fleet.view]}
|
||||
>
|
||||
<ProcurementPage />
|
||||
</RequirePermission>
|
||||
}
|
||||
@@ -811,7 +815,9 @@ const App = () => {
|
||||
<Route
|
||||
path="file-settings"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.admin}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.settings.fileUpload.view, FREIGHT_PERMS.admin]}
|
||||
>
|
||||
<FileUploadSettingsPage />
|
||||
</RequirePermission>
|
||||
}
|
||||
@@ -819,7 +825,9 @@ const App = () => {
|
||||
<Route
|
||||
path="dropdown-settings"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.admin}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.settings.dropdown.view, FREIGHT_PERMS.admin]}
|
||||
>
|
||||
<DropdownSettingsPage />
|
||||
</RequirePermission>
|
||||
}
|
||||
@@ -876,7 +884,9 @@ const App = () => {
|
||||
<Route
|
||||
path="configuration/trade-access"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.admin}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.tradeAccess.view, FREIGHT_PERMS.admin]}
|
||||
>
|
||||
<TradeAccessPage />
|
||||
</RequirePermission>
|
||||
}
|
||||
@@ -884,7 +894,9 @@ const App = () => {
|
||||
<Route
|
||||
path="configuration/exchange-rate"
|
||||
element={
|
||||
<RequirePermission permission={FREIGHT_PERMS.admin}>
|
||||
<RequirePermission
|
||||
permission={[FREIGHT_PERMS.settings.exchangeRate.view, FREIGHT_PERMS.admin]}
|
||||
>
|
||||
<div className="p-4">
|
||||
<ExchangeRateSettingsCard />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user