Candy - Resource authorization for Phoenix

Dead simple resource authorization with only a couple plugs. Inspired by canary.


Contributions are more than welcome, as always!

  1. Why do you assume that there will be only one Repo in all applications running?
  2. Why such simple functionality (call function with and pattern match on arguments) require whole library for that? With licensing, version management, and all that cruft required for using external code?

I found myself copying this exact same code amongst multiple projects, so having it as a separate package made it handier :slight_smile:. I also figured I would share it so that others could have a look and possibly extract ideas they could extrapolate to their own set of authorization plugs.

As for the config, I work with a single Repo so that was fine for me. One could easily add a param to specify a repo per-plug call, or possibly have a get callback on the model/schema itself and go that way instead - but then again, this is where one could grab the published code and modify it as they see fit.

1 Like