Gardien v0.0.2 Gardien.Policy protocol
Protocol used by Gardien for verifying whether user is allowed to perform some action on a given resource.
Implementation example:
defimpl Gardien.Policy, for: MyApplication.Post do
use Gardien.Authorize
def new(_resource, _user) do
true
end
def edit(resource, user) do
resource.user_id == user.id
end
...
end
Summary
Functions
Receives resource
(that needs to be authorized), action
and user
.
authorize?/3
should return true
or false
Types
t :: term
Functions
Receives resource
(that needs to be authorized), action
and user
.
authorize?/3
should return true
or false
.