fix: 过账数据继承应收菜单权限 (#1031)
This commit is contained in:
parent
c47af23709
commit
5e557aa154
@ -412,6 +412,12 @@ class SidebarPermissions
|
||||
$normalized[] = 'financial-operations/shop-flows';
|
||||
}
|
||||
|
||||
// 「过账数据」紧随店铺应收账款展示;旧权限配置没有新菜单键时,
|
||||
// 能访问应收账款的任意页面即可继续看到这个同级入口。
|
||||
if ($normalizedKey === 'store-receivables' || str_starts_with($normalizedKey, 'store-receivables/')) {
|
||||
$normalized[] = 'posting-data';
|
||||
}
|
||||
|
||||
foreach (self::FINAL_SECTION_KEYS as $sectionKey => $finalSectionKey) {
|
||||
if ($normalizedKey === $sectionKey) {
|
||||
$normalized[] = $finalSectionKey;
|
||||
|
||||
@ -135,6 +135,26 @@ class UserPermissionsTest extends FeatureTestCase
|
||||
$this->get(route('system-settings.sidebar.edit', ['subject' => 'user_'.$target->id]))->assertOk()->assertSeeText('自定义权限');
|
||||
}
|
||||
|
||||
public function test_posting_data_follows_store_receivables_permissions(): void
|
||||
{
|
||||
$regular = $this->account('user');
|
||||
$subject = 'user_'.$regular->id;
|
||||
|
||||
foreach (['store-receivables', 'store-receivables/actual-reconciliation'] as $receivablePermission) {
|
||||
setting()->set('system.sidebar_permissions', [
|
||||
'configured' => [$subject],
|
||||
'subjects' => [$subject => [$receivablePermission]],
|
||||
]);
|
||||
|
||||
$allowed = SidebarPermissions::allowedKeys($regular);
|
||||
$navigation = SidebarPermissions::navigationFor($regular);
|
||||
|
||||
$this->assertContains('posting-data', $allowed);
|
||||
$this->assertSame(['store-receivables', 'posting-data'], array_column($navigation, 'slug'));
|
||||
$this->assertSame([], $navigation[1]['pages']);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_refund_export_requires_a_separate_operation_grant_when_page_access_is_limited(): void
|
||||
{
|
||||
$target = $this->account('user');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user