fix(server-transfer): require update access to export bundles

This commit is contained in:
Andras Bacsai
2026-10-18 23:21:16 +02:00
parent 6d2ad920d4
commit c781cddbab
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ class Transfer extends Component
$this->ensureDevelopmentAvailability();
try {
$this->authorize('view', $this->server);
$this->authorize('update', $this->server);
if ($this->isLocalhost) {
throw new \RuntimeException('The Coolify host (localhost) cannot be transferred.');
}
@@ -100,6 +100,17 @@ test('export bundle streams download from livewire', function () {
->assertFileDownloaded('server-transfer-'.$this->server->uuid.'.json');
});
test('team members cannot export a transfer bundle', function () {
$member = User::factory()->create();
$this->team->members()->attach($member->id, ['role' => 'member']);
$this->actingAs($member);
session(['currentTeam' => $this->team]);
Livewire::test(Transfer::class, ['server_uuid' => $this->server->uuid])
->call('exportBundle')
->assertNoFileDownloaded();
});
test('transfer page badge shows the management state of the server', function (string $state, string $label, array $hidden) {
$claimer = app(ServerTransferClaimer::class);
match ($state) {