Merge pull request #6872 from coollabsio/andrasbacsai/db-general-auth-check

fix: add authorization checks to database Livewire components
This commit is contained in:
Andras Bacsai 2025-10-14 17:36:21 +02:00 committed by GitHub
commit 941afa3585
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 14 additions and 0 deletions

View file

@ -85,6 +85,7 @@ class BackupEdit extends Component
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->backup->database);
$this->parameters = get_route_parameters(); $this->parameters = get_route_parameters();
$this->syncData(); $this->syncData();
} catch (Exception $e) { } catch (Exception $e) {

View file

@ -56,6 +56,7 @@ public function getListeners()
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -3,10 +3,12 @@
namespace App\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use Auth; use Auth;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component; use Livewire\Component;
class Configuration extends Component class Configuration extends Component
{ {
use AuthorizesRequests;
public $currentRoute; public $currentRoute;
public $database; public $database;
@ -42,6 +44,8 @@ public function mount()
->where('uuid', request()->route('database_uuid')) ->where('uuid', request()->route('database_uuid'))
->firstOrFail(); ->firstOrFail();
$this->authorize('view', $database);
$this->database = $database; $this->database = $database;
$this->project = $project; $this->project = $project;
$this->environment = $environment; $this->environment = $environment;

View file

@ -62,6 +62,7 @@ public function getListeners()
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -131,6 +131,7 @@ public function getContainers()
if (is_null($resource)) { if (is_null($resource)) {
abort(404); abort(404);
} }
$this->authorize('view', $resource);
$this->resource = $resource; $this->resource = $resource;
$this->server = $this->resource->destination->server; $this->server = $this->resource->destination->server;
$this->container = $this->resource->uuid; $this->container = $this->resource->uuid;

View file

@ -64,6 +64,7 @@ public function getListeners()
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -122,6 +122,7 @@ protected function messages(): array
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -122,6 +122,7 @@ protected function messages(): array
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -127,6 +127,7 @@ protected function messages(): array
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -140,6 +140,7 @@ protected function messages(): array
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {

View file

@ -115,6 +115,7 @@ protected function messages(): array
public function mount() public function mount()
{ {
try { try {
$this->authorize('view', $this->database);
$this->syncData(); $this->syncData();
$this->server = data_get($this->database, 'destination.server'); $this->server = data_get($this->database, 'destination.server');
if (! $this->server) { if (! $this->server) {