View Source Policies.Access (Policies v0.1.2)
Access Policies to be applied
Handle the authorization to restrict pipelines must be part.
The connection must have a user and an mvno logged to continue.
Summary
Functions
Evaluates one or more policies and either returns true
(success) or false
(failure).
Callable as a local plug. Enforce accepts the current conn and a policy indicator. It then calls the policy, evaluates the response and either passes or transforms the conn with a failure.
Evaluates one or more policies and either returns :ok (success) or raises an error.
Callback implementation for PolicyWonk.Policy.policy/2
.
Callback implementation for PolicyWonk.Policy.policy_error/2
.
Functions
Evaluates one or more policies and either returns true
(success) or false
(failure).
This is useful for choosing whether or not to render portions of a template, or for conditional logic in a controller.
Parameters
conn
The current conn in the plug chainpolicy
The policy or policies you want to enforce. This can be either a single term representing one policy, or a list of policy terms.
Callable as a local plug. Enforce accepts the current conn and a policy indicator. It then calls the policy, evaluates the response and either passes or transforms the conn with a failure.
You will normally only use this function if you want to enforce a policy that is written into a controller. Then the plug call will look like this:
plug :enforce, :some_policy
If you want to enforce a policy from your router, please read the PolicyWonk.Enforce
documentation.
Parameters
conn
The current conn in the plug chainpolicy
The policy or policies you want to enforce. This can be either a single term representing one policy, or a list of policy terms.
Evaluates one or more policies and either returns :ok (success) or raises an error.
This is useful for enforcing a policy within an action in a controller.
Parameters
conn
The current conn in the plug chainpolicy
The policy or policies you want to enforce. This can be either a single term representing one policy, or a list of policy terms.
Callback implementation for PolicyWonk.Policy.policy/2
.
Callback implementation for PolicyWonk.Policy.policy_error/2
.