View Source Actors.Security.Acl.Rules.AclEvaluator (spawn v2.0.0-RC1)

AclEvaluatoris responsible for evaluating whether a request can be accepted or not based on the informed Access Control List policy.

Summary

Functions

Applies a policy on a request by evaluating whether the request should pass or not.

Functions

eval(policy, invocation, opts \\ [])

@spec eval(Actors.Security.Acl.Policy.t(), Spawn.InvocationRequest.t(), Keyword.t()) ::
  boolean()

Applies a policy on a request by evaluating whether the request should pass or not.

Example

iex> Actors.Security.Acl.Rules.AclEvaluator.eval(
...> %Actors.Security.Acl.Policy{
...>   name: "the-police",
...>   type: :allow,
...>   actors: ["*"],
...>   actions: ["get"],
...>   actor_systems: ["*"]
...> },
...> %Spawn.InvocationRequest{
...>    actor: %Spawn.Actors.Actor{id: %Spawn.Actors.ActorId{name: "joe"}},
...>    action_name: "get",
...>    caller: %Spawn.Actors.ActorId{name: "robert", system: "actor-system"}
...> }
...> )
true