Fix Host portal showing for users without a linked host profile.
Deploy Ladill Frontdesk / deploy (push) Successful in 28s

Only show the sidebar link when a host record is linked to the signed-in user, and redirect direct visits to the dashboard with a clear message instead of a 403 page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-27 21:13:50 +00:00
co-authored by Cursor
parent ce6d7c5f80
commit 1163b50b39
3 changed files with 35 additions and 11 deletions
+26
View File
@@ -81,6 +81,32 @@ class FrontdeskPhase6Test extends TestCase
->assertSee('Phase6 Host');
}
public function test_org_admin_without_linked_host_cannot_access_host_portal(): void
{
$admin = User::create([
'public_id' => 'phase6-admin-001',
'name' => 'Org Admin',
'email' => 'admin@example.com',
]);
Member::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'user_ref' => $admin->public_id,
'role' => 'org_admin',
]);
$this->actingAs($admin)
->get(route('frontdesk.dashboard'))
->assertOk()
->assertDontSee('Host portal', false);
$this->actingAs($admin)
->get(route('frontdesk.host.index'))
->assertRedirect(route('frontdesk.dashboard'))
->assertSessionHas('error');
}
public function test_host_can_pre_register_visitor(): void
{
$this->actingAs($this->user)