mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Merge remote-tracking branch 'origin/next' into automation/sync-main-to-next
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Models\ApplicationPreview;
|
||||
use App\Models\Server;
|
||||
use App\Models\Service;
|
||||
use App\Models\Tag;
|
||||
use App\Services\Access\AccessResolver;
|
||||
use App\Support\ResourceStartActivity;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -74,7 +75,12 @@ class DeployController extends Controller
|
||||
if (is_null($teamId)) {
|
||||
return invalidTokenResponse();
|
||||
}
|
||||
$deployments_per_server = ApplicationDeploymentQueue::ownedByTeam((int) $teamId)->whereIn('status', ['in_progress', 'queued'])->get()->sortBy('id');
|
||||
$query = ApplicationDeploymentQueue::ownedByTeam((int) $teamId)->whereIn('status', ['in_progress', 'queued']);
|
||||
if (! app(AccessResolver::class)->coversWholeTeam($request->user(), $teamId)) {
|
||||
// application_id is a string column, so compare with string IDs of the applications the actor can see.
|
||||
$query->whereIn('application_id', Application::ownedByCurrentTeamAPI($teamId)->pluck('id')->map(fn ($id) => (string) $id));
|
||||
}
|
||||
$deployments_per_server = $query->get()->sortBy('id');
|
||||
$deployments_per_server = $deployments_per_server->map(function ($deployment) {
|
||||
return $this->removeSensitiveData($deployment);
|
||||
});
|
||||
@@ -232,6 +238,11 @@ class DeployController extends Controller
|
||||
if (! $application || data_get($application->team(), 'id') !== (int) $teamId) {
|
||||
return response()->json(['message' => 'You do not have permission to cancel this deployment.'], 403);
|
||||
}
|
||||
// For an actor limited by access grants, deployments of applications outside the grants do not exist.
|
||||
// Soft-deleted applications stay included so a deploy that runs during a delete can still be cancelled.
|
||||
if (! app(AccessResolver::class)->coversWholeTeam($request->user(), $teamId)) {
|
||||
$this->authorize('deploy', $application);
|
||||
}
|
||||
|
||||
// Check if deployment can be cancelled (must be queued or in_progress)
|
||||
$cancellableStatuses = [
|
||||
|
||||
Reference in New Issue
Block a user