Skip to content

Commit 8d1067f

Browse files
committed
Auth permission updates
1 parent 56ff5a8 commit 8d1067f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ret_web/channels/hub_channel.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ defmodule RetWeb.HubChannel do
297297
account = Guardian.Phoenix.Socket.current_resource(socket)
298298
hub = socket |> hub_for_socket
299299

300-
if (type != "photo" and type != "video") or account |> can?(spawn_camera(hub)) do
300+
if (type == "photo" and type == "video" and !account |> can?(spawn_camera(hub))) or
301+
(type == "permission" and !Ret.Hub.is_owner?(account.account_id)) do
302+
{:noreply, socket}
303+
end
304+
301305
broadcast!(
302306
socket,
303307
event,
@@ -306,7 +310,6 @@ defmodule RetWeb.HubChannel do
306310
|> Map.put(:session_id, socket.assigns.session_id)
307311
|> payload_with_from(socket)
308312
)
309-
end
310313

311314
{:noreply, socket}
312315
end

0 commit comments

Comments
 (0)