fix: 订单利润继承订单数据权限 #977
@ -427,6 +427,11 @@ class SidebarPermissions
|
||||
$normalized[] = 'fee-ratio-monitoring/refund-pending/export-details';
|
||||
$normalized[] = 'fee-ratio-monitoring/cost-freight-anomaly';
|
||||
}
|
||||
|
||||
if ($key === 'order-data' || str_starts_with($key, 'order-data/')) {
|
||||
$normalized[] = 'order-profit';
|
||||
$normalized[] = 'order-profit/order-profit-list';
|
||||
}
|
||||
}
|
||||
|
||||
return array_values(array_unique($normalized));
|
||||
|
||||
@ -369,6 +369,25 @@ class NavigationTest extends FeatureTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testOrderProfitInheritsLegacyOrderDataPermission(): void
|
||||
{
|
||||
$this->user->roles()->sync([Role::where('name', 'user')->firstOrFail()->id]);
|
||||
$subject = 'user_' . $this->user->id;
|
||||
setting()->set('system.sidebar_permissions', [
|
||||
'configured' => [$subject],
|
||||
'subjects' => [$subject => [
|
||||
'order-data',
|
||||
'order-data/raw-data',
|
||||
]],
|
||||
]);
|
||||
setting()->save();
|
||||
|
||||
$allowed = SidebarPermissions::allowedKeys($this->user);
|
||||
|
||||
$this->assertContains('order-profit', $allowed);
|
||||
$this->assertContains('order-profit/order-profit-list', $allowed);
|
||||
}
|
||||
|
||||
public function testPrototypeSidebarDoesNotDuplicateOtherDirectoryPages(): void
|
||||
{
|
||||
$prototypePages = collect(SidebarMenu::groups($this->user))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user