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
feat: Add AdminRemoveUser command to remove users from the database
Andras Bacsaie95e2cf152be
diff --git a/app/Console/Commands/AdminRemoveUser.php b/app/Console/Commands/AdminRemoveUser.phpnew file mode 100644index 0000000000..76af0a97f7--- /dev/null+++ b/app/Console/Commands/AdminRemoveUser.php@@ -0,0 +1,54 @@+<?php++namespace App\Console\Commands;++use App\Models\Server;+use App\Models\User;+use Illuminate\Console\Command;++class AdminRemoveUser extends Command+{+ /**+ * The name and signature of the console command.+ *+ * @var string+ */+ protected $signature = 'admin:remove-user {email}';++ /**+ * The console command description.+ *+ * @var string+ */+ protected $description = 'Remove User from database';++ /**+ * Execute the console command.+ */+ public function handle()+ {+ try {+ $email = $this->argument('email');+ $confirm = $this->confirm('Are you sure you want to remove user with email: ' . $email . '?');+ if (!$confirm) {+ $this->info('User removal cancelled.');+ return;+ }+ $this->info("Removing user with email: $email");+ $user = User::whereEmail($email)->firstOrFail();+ $teams = $user->teams;+ foreach ($teams as $team) {+ if ($team->members->count() > 1) {+ $this->error('User is a member of a team with more than one member. Please remove user from team first.');+ return;+ }+ $team->delete();+ }+ $user->delete();+ } catch (\Exception $e) {+ $this->error('Failed to remove user.');+ $this->error($e->getMessage());+ return;+ }+ }+}diff --git a/app/Console/Commands/Cloud.php b/app/Console/Commands/Cloud.phpdeleted file mode 100644index 1386b296c9..0000000000--- a/app/Console/Commands/Cloud.php+++ /dev/null@@ -1,33 +0,0 @@-<?php--namespace App\Console\Commands;--use App\Models\Server;-use Illuminate\Console\Command;--class Cloud extends Command-{- /**- * The name and signature of the console command.- *- * @var string- */- protected $signature = 'cloud:unused-servers';-- /**- * The console command description.- *- * @var string- */- protected $description = 'Get Unused Servers from Cloud';-- /**- * Execute the console command.- */- public function handle()- {- Server::all()->whereNotNull('team.subscription')->where('team.subscription.stripe_trial_already_ended',true)->each(function($server){- $this->info($server->name);- });- }-}diff --git a/app/Console/Commands/RootResetPassword.php b/app/Console/Commands/RootResetPassword.phpindex df385002e4..af2b1a45c0 100644--- a/app/Console/Commands/RootResetPassword.php+++ b/app/Console/Commands/RootResetPassword.php@@ -29,7 +29,6 @@ class RootResetPassword extends Command*/public function handle(){- //$this->info('You are about to reset the root password.');$password = password('Give me a new password for root user: ');$passwordAgain = password('Again');diff --git a/app/Livewire/Project/Shared/ScheduledTask/All.php b/app/Livewire/Project/Shared/ScheduledTask/All.phpindex 73b2733b45..5182639d7d 100644--- a/app/Livewire/Project/Shared/ScheduledTask/All.php+++ b/app/Livewire/Project/Shared/ScheduledTask/All.php@@ -20,7 +20,6 @@ class All extends Componentif ($this->resource->type() == 'service') {$this->containerNames = $this->resource->applications()->pluck('name');$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));- ray($this->containerNames);} elseif ($this->resource->type() == 'application') {if ($this->resource->build_pack === 'dockercompose') {$parsed = $this->resource->parseCompose();