限制系统参数配置为站长专属
This commit is contained in:
@@ -152,12 +152,44 @@ class AdminSystemControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证非站长的高等级后台用户不能访问系统参数页。
|
||||
*/
|
||||
public function test_non_site_owner_cannot_access_system_page(): void
|
||||
{
|
||||
$this->seedSystemParams();
|
||||
$admin = User::factory()->create([
|
||||
'user_level' => 100,
|
||||
]);
|
||||
|
||||
$this->actingAs($admin)
|
||||
->get(route('admin.system.edit'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证非站长的高等级后台用户看不到系统参数菜单入口。
|
||||
*/
|
||||
public function test_non_site_owner_dashboard_hides_system_menu_link(): void
|
||||
{
|
||||
$this->seedSystemParams();
|
||||
$admin = User::factory()->create([
|
||||
'user_level' => 100,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($admin)->get(route('admin.dashboard'));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertDontSee('⚙️ 聊天室参数', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建可访问后台通用系统页的超级管理员账号。
|
||||
*/
|
||||
private function createSuperAdmin(): User
|
||||
{
|
||||
return User::factory()->create([
|
||||
'id' => 1,
|
||||
'user_level' => 100,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user