feat(security): add authorization checks for package updates in Livewire components
This commit is contained in:
parent
8408205955
commit
37ee6717e9
1 changed files with 3 additions and 1 deletions
|
|
@ -69,8 +69,9 @@ public function checkForUpdates()
|
|||
|
||||
public function updateAllPackages()
|
||||
{
|
||||
$this->authorize('update', $this->server);
|
||||
if (! $this->packageManager || ! $this->osId) {
|
||||
$this->dispatch('error', message: 'Run “Check for updates” first.');
|
||||
$this->dispatch('error', message: 'Run "Check for updates" first.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -91,6 +92,7 @@ public function updateAllPackages()
|
|||
public function updatePackage($package)
|
||||
{
|
||||
try {
|
||||
$this->authorize('update', $this->server);
|
||||
$activity = UpdatePackage::run(server: $this->server, packageManager: $this->packageManager, osId: $this->osId, package: $package);
|
||||
$this->dispatch('activityMonitor', $activity->id, ServerPackageUpdated::class);
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue