mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
Add authorization checks to multiple Livewire components to ensure users have proper permissions before performing sensitive operations. This includes: - Adding AuthorizesRequests trait to components handling deployments, backups, services, and configuration uploads - Enforcing 'deploy', 'update', and 'manageBackups' authorization checks - Adding instance admin check for system upgrade operations - Improving database queries with team ownership scope - Moving backup trigger from component to button with new backupNow() method
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Shared;
|
|
|
|
use App\Models\Application;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Livewire\Component;
|
|
|
|
class UploadConfig extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
public $config;
|
|
|
|
public $applicationId;
|
|
|
|
public function mount()
|
|
{
|
|
if (isDev()) {
|
|
$this->config = '{
|
|
"build_pack": "nixpacks",
|
|
"base_directory": "/nodejs",
|
|
"publish_directory": "/",
|
|
"ports_exposes": "3000",
|
|
"settings": {
|
|
"is_static": false
|
|
}
|
|
}';
|
|
}
|
|
}
|
|
|
|
public function uploadConfig()
|
|
{
|
|
try {
|
|
$application = Application::ownedByCurrentTeam()->findOrFail($this->applicationId);
|
|
$this->authorize('update', $application);
|
|
$application->setConfig($this->config);
|
|
$this->dispatch('success', 'Application settings updated');
|
|
} catch (\Throwable $e) {
|
|
return handleError($e, $this);
|
|
}
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.project.shared.upload-config');
|
|
}
|
|
}
|