ex_admin
ex_admin copied to clipboard
Custom actions authorization
Related to #334
Things in which I'm not confident enough:
- Custom map instead of conn object. Currently I forward only action name (for pattern matching) and id (to find resource for member actions):
But maybe someone needs more data for authorisation. On the other side I don't want to put specific data inside%{action: custom_action_name, id: id} |> Utils.authorized_action?(action, resource_model)%Plug.Conn{}struct. As a compromise I think about putting:ex_admin_metadatakey insideconn.assignsmap. - 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 ofex_admindomain.
I understand that you may not accept this PR without proper module design