Skip to content

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.

Fix access control in Admin Index and hide Admin link in navbar

Andras Bacsai9350fb4b9713
diff --git a/app/Livewire/Admin/Index.php b/app/Livewire/Admin/Index.php
index 1908fe107c..75b3f1d226 100644
--- a/app/Livewire/Admin/Index.php
+++ b/app/Livewire/Admin/Index.php
@@ -11,7 +11,7 @@ class Index extends Component
public $users = [];
public function mount()
{
- if (!isInstanceAdmin()) {
+ if (auth()->user()->id !== 0) {
return redirect()->route('dashboard');
}
$this->users = User::whereHas('teams', function ($query) {
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 04ce6257f8..5d7eae25b5 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -142,7 +142,7 @@
</ul>
</details>
- @if (isCloud() && isInstanceAdmin())
+ {{-- @if (isCloud() && isInstanceAdmin())
<li title="Admin">
<a class="hover:bg-transparent" href="/admin">
<svg class="text-pink-600 icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
@@ -151,7 +151,7 @@
</svg>
</a>
</li>
- @endif
+ @endif --}}
<div class="flex-1"></div>
@if (isInstanceAdmin() && !isCloud())
@persist('upgrade')