diff --git a/resources/views/livewire/manage-users.blade.php b/resources/views/livewire/manage-users.blade.php
index 6284d79..799869b 100644
--- a/resources/views/livewire/manage-users.blade.php
+++ b/resources/views/livewire/manage-users.blade.php
@@ -1,4 +1,4 @@
-@can('viewAny', App\Models\User::class)
+
Users
@@ -95,4 +95,4 @@
@endcan
-@endcan
\ No newline at end of file
+
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index 831b1ee..8531fca 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -2,6 +2,7 @@
use App\Http\Controllers\OIDCController;
use App\Livewire\ConsentScreen;
+use App\Livewire\ManageUsers;
use App\Livewire\Settings\Appearance;
use App\Livewire\Settings\Password;
use App\Livewire\Settings\Profile;
@@ -19,6 +20,10 @@ Route::view('dashboard', 'dashboard')
->middleware(['auth', 'verified'])
->name('dashboard');
+Route::get('admin/users', ManageUsers::class)
+ ->middleware(['auth', 'can:viewAny,App\Models\User'])
+ ->name('admin.users');
+
Route::middleware(['auth'])->group(function () {
Route::redirect('settings', 'settings/profile');
diff --git a/tests/Feature/UserManagementPageTest.php b/tests/Feature/UserManagementPageTest.php
new file mode 100644
index 0000000..ed9bd33
--- /dev/null
+++ b/tests/Feature/UserManagementPageTest.php
@@ -0,0 +1,59 @@
+admin = User::factory()->create(['is_admin' => true]);
+ $this->user = User::factory()->create(['is_admin' => false]);
+});
+
+describe('User Management Page', function () {
+
+ it('allows admin users to access the user management page', function () {
+ $this->actingAs($this->admin);
+
+ $response = $this->get(route('admin.users'));
+
+ $response->assertStatus(200);
+ $response->assertSee('User Management');
+ $response->assertSee('Users');
+ $response->assertSee('Invitations');
+ });
+
+ it('prevents non-admin users from accessing the user management page', function () {
+ $this->actingAs($this->user);
+
+ $response = $this->get(route('admin.users'));
+
+ $response->assertStatus(403);
+ });
+
+ it('redirects unauthenticated users to login', function () {
+ $response = $this->get(route('admin.users'));
+
+ $response->assertRedirect(route('login'));
+ });
+
+ it('shows the user management navigation link only to admins', function () {
+ // Test admin sees the link
+ $this->actingAs($this->admin);
+ $response = $this->get(route('dashboard'));
+ $response->assertSee('User Management');
+
+ // Test regular user doesn't see the link in navigation
+ $this->actingAs($this->user);
+ $response = $this->get(route('dashboard'));
+ $response->assertDontSee('href="' . route('admin.users') . '"', false);
+ });
+
+ it('properly displays the page title', function () {
+ $this->actingAs($this->admin);
+
+ $response = $this->get(route('admin.users'));
+
+ $response->assertSee('
User Management', false);
+ });
+});
\ No newline at end of file