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
@@ -6,10 +6,10 @@ use App\Http\Controllers\Controller;
use App\Http\Controllers\Frontdesk\Concerns\ScopesToAccount;
use App\Models\Host;
use App\Models\Visit;
use App\Services\Frontdesk\FrontdeskPermissions;
use App\Services\Frontdesk\OrganizationResolver;
use App\Services\Frontdesk\VisitLifecycleService;
use App\Services\Frontdesk\VisitScheduleService;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
@@ -114,17 +114,15 @@ class HostPortalController extends Controller
protected function resolveLinkedHost(Request $request): Host
{
$permissions = app(FrontdeskPermissions::class);
$member = $this->member($request);
abort_unless(
$permissions->can($member, 'host.portal') || app(OrganizationResolver::class)->hostFor($request->user()) !== null,
403,
);
$host = app(OrganizationResolver::class)->hostFor($request->user());
abort_unless($host, 403, 'No host profile linked to your account.');
if (! $host) {
throw new HttpResponseException(
redirect()
->route('frontdesk.dashboard')
->with('error', 'No host profile is linked to your account. Ask an administrator to link your Ladill user on the Hosts screen.'),
);
}
$this->authorizeOwner($request, $host);