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
better impersonate
Andras Bacsaia0ad4bc90e69
diff --git a/app/Livewire/Admin/Index.php b/app/Livewire/Admin/Index.phpindex 359db63298..b5f6d29294 100644--- a/app/Livewire/Admin/Index.php+++ b/app/Livewire/Admin/Index.php@@ -21,16 +21,28 @@ class Index extends Componentpublic function mount(){- if (! isCloud()) {+ if (! isCloud() && ! isDev()) {return redirect()->route('dashboard');}-- if (Auth::id() !== 0) {+ if (Auth::id() !== 0 && ! session('impersonating')) {return redirect()->route('dashboard');}$this->getSubscribers();}+ public function back()+ {+ if (session('impersonating')) {+ session()->forget('impersonating');+ $user = User::find(0);+ $team_to_switch_to = $user->teams->first();+ Auth::login($user);+ refreshSession($team_to_switch_to);++ return redirect(request()->header('Referer'));+ }+ }+public function submitSearch(){if ($this->search !== '') {@@ -52,9 +64,10 @@ class Index extends Componentif (Auth::id() !== 0) {return redirect()->route('dashboard');}+ session(['impersonating' => true]);$user = User::find($user_id);$team_to_switch_to = $user->teams->first();- Cache::forget("team:{$user->id}");+ // Cache::forget("team:{$user->id}");Auth::login($user);refreshSession($team_to_switch_to);diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.phpindex 7d343c645d..9a75200b10 100644--- a/resources/views/components/navbar.blade.php+++ b/resources/views/components/navbar.blade.php@@ -340,17 +340,19 @@</li>@endif- @if (isCloud() && isInstanceAdmin())- <li>- <a title="Admin" class="menu-item" href="/admin">- <svg class="text-pink-600 icon" viewBox="0 0 256 256"- xmlns="http://www.w3.org/2000/svg">- <path fill="currentColor"- d="M177.62 159.6a52 52 0 0 1-34 34a12.2 12.2 0 0 1-3.6.55a12 12 0 0 1-3.6-23.45a28 28 0 0 0 18.32-18.32a12 12 0 0 1 22.9 7.2ZM220 144a92 92 0 0 1-184 0c0-28.81 11.27-58.18 33.48-87.28a12 12 0 0 1 17.9-1.33l19.69 19.11L127 19.89a12 12 0 0 1 18.94-5.12C168.2 33.25 220 82.85 220 144m-24 0c0-41.71-30.61-78.39-52.52-99.29l-20.21 55.4a12 12 0 0 1-19.63 4.5L80.71 82.36C67 103.38 60 124.06 60 144a68 68 0 0 0 136 0" />- </svg>- Admin- </a>- </li>+ @if (isCloud() || isDev())+ @if (isInstanceAdmin() || session('impersonating'))+ <li>+ <a title="Admin" class="menu-item" href="/admin">+ <svg class="text-pink-600 icon" viewBox="0 0 256 256"+ xmlns="http://www.w3.org/2000/svg">+ <path fill="currentColor"+ d="M177.62 159.6a52 52 0 0 1-34 34a12.2 12.2 0 0 1-3.6.55a12 12 0 0 1-3.6-23.45a28 28 0 0 0 18.32-18.32a12 12 0 0 1 22.9 7.2ZM220 144a92 92 0 0 1-184 0c0-28.81 11.27-58.18 33.48-87.28a12 12 0 0 1 17.9-1.33l19.69 19.11L127 19.89a12 12 0 0 1 18.94-5.12C168.2 33.25 220 82.85 220 144m-24 0c0-41.71-30.61-78.39-52.52-99.29l-20.21 55.4a12 12 0 0 1-19.63 4.5L80.71 82.36C67 103.38 60 124.06 60 144a68 68 0 0 0 136 0" />+ </svg>+ Admin+ </a>+ </li>+ @endif@endif<div class="flex-1"></div>@if (isInstanceAdmin() && !isCloud())diff --git a/resources/views/livewire/admin/index.blade.php b/resources/views/livewire/admin/index.blade.phpindex 06914e1e45..7bf3c7c0c6 100644--- a/resources/views/livewire/admin/index.blade.php+++ b/resources/views/livewire/admin/index.blade.php@@ -1,7 +1,12 @@<div><h1>Admin Dashboard</h1>- <h3 class="pt-4">Who am I now?</h3>- <div class="pb-4">{{ auth()->user()->name }}</div>+ <div class="flex gap-2 pt-4">+ <h3>Who am I now?</h3>+ @if (session('impersonating'))+ <x-forms.button wire:click="back">Go back to root</x-forms.button>+ @endif+ </div>+ <div class="pb-4">{{ auth()->user()->name }} ({{ auth()->user()->email }})</div><form wire:submit="submitSearch" class="flex flex-col gap-2 lg:flex-row"><x-forms.input wire:model="search" placeholder="Search for a user" /><x-forms.button type="submit">Search</x-forms.button>