Skip to content

Commit

Permalink
Auth permission updates
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jun 23, 2023
1 parent 56ff5a8 commit 8d1067f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ret_web/channels/hub_channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ defmodule RetWeb.HubChannel do
account = Guardian.Phoenix.Socket.current_resource(socket)
hub = socket |> hub_for_socket

if (type != "photo" and type != "video") or account |> can?(spawn_camera(hub)) do
if (type == "photo" and type == "video" and !account |> can?(spawn_camera(hub))) or
(type == "permission" and !Ret.Hub.is_owner?(account.account_id)) do
{:noreply, socket}
end

broadcast!(
socket,
event,
Expand All @@ -306,7 +310,6 @@ defmodule RetWeb.HubChannel do
|> Map.put(:session_id, socket.assigns.session_id)
|> payload_with_from(socket)
)
end

{:noreply, socket}
end
Expand Down

0 comments on commit 8d1067f

Please sign in to comment.