Ok so in just 1 day I have almost ported my Rails API over to Phoenix, thanks everyone!
So in rails I have a class where I take in a few models as inputs, and based on those models I created my authorization class that I use in my controllers.
class PermissionService attr_access :model1, :model2, :model3 def initialize(model1, model2, model3) ... end def can_do_this?() model1.prop1 && model3.prop5 end def can_do_that?() end end
So far in Phoenix I created a custom Plug that I can in my API pipeline, I get the api token from the request and I load etc. using Ecto.
How would I design a module?? to mimick my PermissionService I have in ruby.