Datacop.permit
You're seeing just the function
permit
, go back to Datacop module for more information.
Link to this function
permit(module, action, actor, opts \\ [])
Specs
permit(policy :: module(), action(), actor(), opts :: [option()]) :: :ok | {:error, Datacop.UnauthorizedError.t()}
Authorize an action.
Processes Datacop.Policy.authorize/3
result.
Examples
> Datacop.permit(MyApp.Accounts, :view_email, current_user, subject: other_user)
:ok
> Datacop.permit(MyApp.Accounts, :view_email, current_user, subject: other_user, loader: loader)
{:error, %Datacop.UnauthorizedError{message: "Unauthorized"}}