diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index b06235221..80c96f974 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -195,9 +195,18 @@ class="{{ request()->is('settings*') ? 'menu-item-active menu-item' : 'menu-item @endif - @endif + @if (auth()->id() === 0 && (isCloud() || isDev())) +
  • + + + Admin + +
  • + @endif @if (isCloud() && ! isSubscribed()) {{-- Unsubscribed cloud has no workspace items — keep these at the top of the list. --}} diff --git a/resources/views/components/reicon.blade.php b/resources/views/components/reicon.blade.php index d932dd8fe..04471497f 100644 --- a/resources/views/components/reicon.blade.php +++ b/resources/views/components/reicon.blade.php @@ -6,6 +6,7 @@ // copy the inner markup from the reicon Outline weight and swap // #000000 -> currentColor. See DESIGN.md. $icons = [ + 'fire' => '', 'cloud' => '', 'code' => '', 'mail' => '', diff --git a/tests/Feature/AdminAccessAuthorizationTest.php b/tests/Feature/AdminAccessAuthorizationTest.php index 97895ecda..478f381d5 100644 --- a/tests/Feature/AdminAccessAuthorizationTest.php +++ b/tests/Feature/AdminAccessAuthorizationTest.php @@ -5,6 +5,7 @@ use App\Models\Team; use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Support\Facades\Blade; use Livewire\Livewire; uses(RefreshDatabase::class); @@ -157,3 +158,28 @@ expect($middleware)->toContain('auth'); }); + +test('root user sees the admin link in the navbar', function () { + config()->set('constants.coolify.self_hosted', false); + + $rootUser = User::factory()->create(['id' => 0]); + $this->actingAs($rootUser); + + $navbar = Blade::render(''); + + expect($navbar) + ->toContain('href="'.route('admin.index').'"') + ->toContain('title="Admin"') + ->toContain('text-pink-500'); +}); + +test('non-root user does not see the admin link in the navbar', function () { + config()->set('constants.coolify.self_hosted', false); + + $user = User::factory()->create(); + $this->actingAs($user); + + $navbar = Blade::render(''); + + expect($navbar)->not->toContain('href="'.route('admin.index').'"'); +});