Skip to content

Releases: curiosum-dev/permit

v0.3.0

03 Jun 20:46

Choose a tag to compare

Changed

  • [Breaking] Change order of args in Permit.verify_record/3 and add delegation as do?/3 when doing use Permit.

    This way, permisisons to perform a dynamically computed action can be checked like this:

    action = :read
    can(user) |> do?(action, %Item{id: 1})

    instead of the previously required, rather clumsy, and undocumented notation:

    # Note: this is the previously used argument order; as of now, arguments 2 and 3 have been reversed.
    can(user) |> Permit.verify_record(%Item{id: 1}, action)

    If you happened to use Permit.verify_record(3), the way to migrate is swapping arguments 2 and 3 in all calls, or - better still - migrating to the do?/3 syntactic sugar.

Fixed

  • Update CI configuration and dependencies.