An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: add authorization checks for environment and project views
Andras Bacsaice134cb8b109
diff --git a/app/Livewire/SharedVariables/Environment/Show.php b/app/Livewire/SharedVariables/Environment/Show.phpindex 328986cea0..0bdc1503f4 100644--- a/app/Livewire/SharedVariables/Environment/Show.php+++ b/app/Livewire/SharedVariables/Environment/Show.php@@ -60,6 +60,7 @@ class Show extends Componentpublic function switch(){+ $this->authorize('view', $this->environment);$this->view = $this->view === 'normal' ? 'dev' : 'normal';$this->getDevView();}diff --git a/app/Livewire/SharedVariables/Project/Show.php b/app/Livewire/SharedVariables/Project/Show.phpindex 93ead33a33..b205ea1ec8 100644--- a/app/Livewire/SharedVariables/Project/Show.php+++ b/app/Livewire/SharedVariables/Project/Show.php@@ -57,6 +57,7 @@ class Show extends Componentpublic function switch(){+ $this->authorize('view', $this->project);$this->view = $this->view === 'normal' ? 'dev' : 'normal';$this->getDevView();}@@ -97,25 +98,19 @@ class Show extends Component{$variables = parseEnvFormatToArray($this->variables);- DB::transaction(function () use ($variables) {- $changesMade = false;-+ $changesMade = DB::transaction(function () use ($variables) {// Delete removed variables$deletedCount = $this->deleteRemovedVariables($variables);- if ($deletedCount > 0) {- $changesMade = true;- }// Update or create variables$updatedCount = $this->updateOrCreateVariables($variables);- if ($updatedCount > 0) {- $changesMade = true;- }- if ($changesMade) {- $this->dispatch('success', 'Environment variables updated.');- }+ return $deletedCount > 0 || $updatedCount > 0;});++ if ($changesMade) {+ $this->dispatch('success', 'Environment variables updated.');+ }}private function deleteRemovedVariables($variables)diff --git a/app/Livewire/SharedVariables/Team/Index.php b/app/Livewire/SharedVariables/Team/Index.phpindex bd23bca82e..e420686f06 100644--- a/app/Livewire/SharedVariables/Team/Index.php+++ b/app/Livewire/SharedVariables/Team/Index.php@@ -51,6 +51,7 @@ class Index extends Componentpublic function switch(){+ $this->authorize('view', $this->team);$this->view = $this->view === 'normal' ? 'dev' : 'normal';$this->getDevView();}@@ -90,10 +91,9 @@ class Index extends Componentprivate function handleBulkSubmit(){$variables = parseEnvFormatToArray($this->variables);+ $changesMade = false;- DB::transaction(function () use ($variables) {- $changesMade = false;-+ DB::transaction(function () use ($variables, &$changesMade) {// Delete removed variables$deletedCount = $this->deleteRemovedVariables($variables);if ($deletedCount > 0) {@@ -105,11 +105,11 @@ class Index extends Componentif ($updatedCount > 0) {$changesMade = true;}-- if ($changesMade) {- $this->dispatch('success', 'Environment variables updated.');- }});++ if ($changesMade) {+ $this->dispatch('success', 'Environment variables updated.');+ }}private function deleteRemovedVariables($variables)