fix: handle nil site in graph_live access check
Similar to previous fix - use device.organization_id directly instead of device.site.organization_id to avoid BadMapError when device has no site.
This commit is contained in:
parent
95c6f53d15
commit
129bc9a8f4
1 changed files with 2 additions and 4 deletions
|
|
@ -28,10 +28,8 @@ defmodule ToweropsWeb.GraphLive.Show do
|
|||
|> push_navigate(to: ~p"/devices")}
|
||||
|
||||
device ->
|
||||
# Preload site and organization to check access
|
||||
device = Repo.preload(device, site: :organization)
|
||||
|
||||
if device.site.organization_id == organization.id do
|
||||
# Check if device belongs to current organization
|
||||
if device.organization_id == organization.id do
|
||||
maybe_subscribe_to_device(socket, device_id)
|
||||
|
||||
range = Map.get(params, "range", "24h")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue