Skip to content

Commit

Permalink
[#1] Fix action retrieval in authorize_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanbush committed Mar 29, 2024
1 parent 0de7a58 commit d9103e1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/permit_phoenix/live_view/authorize_hook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ defmodule Permit.Phoenix.LiveView.AuthorizeHook do
defp just_authorize(socket) do
authorization_module = socket.view.authorization_module()
events = socket.view.get_events()
resource_module = extract_resource_module(events, action, socket.view.resource_module())

# TODO: change socket.assigns.live_action to action from function params
# when event authorization is merged in
resource_module =
extract_resource_module(events, socket.assigns.live_action, socket.view.resource_module())

resolver_module = authorization_module.resolver_module()
subject = socket.assigns.current_user
action = socket.assigns.live_action
Expand All @@ -170,7 +175,12 @@ defmodule Permit.Phoenix.LiveView.AuthorizeHook do
actions_module = authorization_module.actions_module()
resolver_module = authorization_module.resolver_module()
events = socket.view.get_events()
resource_module = extract_resource_module(events, action, socket.view.resource_module())

# TODO: change socket.assigns.live_action to action from function params
# when event authorization is merged in

resource_module =
extract_resource_module(events, socket.assigns.live_action, socket.view.resource_module())

base_query = &socket.view.base_query/1
loader = &socket.view.loader/1
Expand Down

0 comments on commit d9103e1

Please sign in to comment.