mix permit.patch.controller (permit_phoenix v0.5.0)

Copy Markdown View Source

Patches an existing Phoenix controller to use Permit authorization.

Adds use Permit.Phoenix.Controller with the specified authorization_module and resource_module. If the controller already has use Permit.Phoenix.Controller but no resource_module, adds a resource_module/0 callback before the first function definition.

Usage

mix permit.patch.controller MyAppWeb.ItemController MyApp.Item

Arguments

  • controller_name (required) - The controller module to patch
  • resource_module (required) - The Ecto schema or resource module

Options

  • --authorization-module - Authorization module name (default: <MyApp>.Authorization)