-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem description
Currently, the event_mapping/0 callback is an arguably inconvenient way to map handle_event event names to Permit action names.
We would like to explore more convenient alternatives that allow the developer to keep the mapping closer to the event handler definition itself, for better code readability.
Proposed solution
A combination of private and public module attributes controlled using a before_compile callback could be used to facilitate the new method of mapping, while at the same time preserving backwards compatibility.
Alternatives considered
No response
Use case
Implementing LiveViews with events authorized using Permit.Phoenix.LiveView.
Desired API/code example
@permit_action :update
def handle_event("save", %{"article" => article_params}, socket) do
article = socket.assigns.loaded_resource
# ...
endComponent
LiveView
Priority (1-3)
3 - High - Blocking my work
Additional Context
No response
Checklist
- I have searched for existing issues before creating this one
- I have checked the roadmap in the README
- This is a feature request, not a bug report or question. For general questions, please use Elixir Slack's Permit channel.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request