simple_can v1.0.0 SimpleCan View Source
This provides the basic can?
function that you can use to check authorization.
Example
def MyApp.SecretPlace do
import SimpleCan
def do_awesome_stuff do
if can?(user, :create, thing) do
created_thing = create_thing(user)
{:ok, created_thing}
else
{:error, :no_access}
end
end
end
Link to this section Summary
Functions
The function to check if an actor can take an action on a subject. This will
call the can?/3
function of an implementation of the SimpleCan.Can
protocol
Link to this section Functions
Link to this function
can?(actor, action, subject)
View Source
can?(any(), atom(), any()) :: boolean()
The function to check if an actor can take an action on a subject. This will
call the can?/3
function of an implementation of the SimpleCan.Can
protocol.