ex_admin icon indicating copy to clipboard operation
ex_admin copied to clipboard

Custom actions authorization

Open sineed opened this issue 9 years ago • 0 comments

Related to #334

Things in which I'm not confident enough:

  1. Custom map instead of conn object. Currently I forward only action name (for pattern matching) and id (to find resource for member actions):
    %{action: custom_action_name, id: id}
    |> Utils.authorized_action?(action, resource_model) 
    
    But maybe someone needs more data for authorisation. On the other side I don't want to put specific data inside %Plug.Conn{} struct. As a compromise I think about putting :ex_admin_metadata key inside conn.assigns map.
  2. Refactoring. I only extracted functions from ExAdmin. I started to go further but realised that this is not as simple as I thought. I don't think that 7 arguments is good for functions but currently I have bad knowledge of ex_admin domain.

I understand that you may not accept this PR without proper module design

sineed avatar Mar 29 '17 15:03 sineed