mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-25 18:25:58 +00:00
Restrict V5 application and resource-connection creation to team admins. Resolve project, environment, and application from query params and keep session selection in sync. Surface V5 apps on the v4 resource index and count them for project/environment emptiness. Create the flux data dir on install and upgrade.
34 lines
1010 B
PHP
34 lines
1010 B
PHP
<?php
|
|
|
|
use App\Models\V5\Application as V5Application;
|
|
use App\Models\V5\ResourceConnection;
|
|
|
|
beforeEach(function () {
|
|
resetV5DashboardTestState();
|
|
createSharedUserAndTeamTables();
|
|
});
|
|
|
|
it('prevents team members from creating v5 applications', function () {
|
|
[$user, $team] = createV5UserWithTeam();
|
|
$user->teams()->updateExistingPivot($team->id, ['role' => 'member']);
|
|
|
|
$this->actingAs($user)
|
|
->withSession(['currentTeam' => $team])
|
|
->postJson('/v5/applications/nginx')
|
|
->assertForbidden();
|
|
|
|
expect(V5Application::query()->count())->toBe(0);
|
|
});
|
|
|
|
it('prevents team members from creating v5 resource connections', function () {
|
|
[$user, $team] = createV5UserWithTeam();
|
|
$user->teams()->updateExistingPivot($team->id, ['role' => 'member']);
|
|
|
|
$this->actingAs($user)
|
|
->withSession(['currentTeam' => $team])
|
|
->postJson('/v5/resource-connections')
|
|
->assertForbidden();
|
|
|
|
expect(ResourceConnection::query()->count())->toBe(0);
|
|
});
|