View Source Actors.Security.Acl.Rules.AclEvaluator (spawn v1.0.0-rc.28)

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

Link to this function

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

View Source
@spec eval(
  Actors.Security.Acl.Policy.t(),
  Eigr.Functions.Protocol.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: ["*"]
...> },
...> %Eigr.Functions.Protocol.InvocationRequest{
...>    actor: %Eigr.Functions.Protocol.Actors.Actor{id: %Eigr.Functions.Protocol.Actors.ActorId{name: "joe"}},
...>    action_name: "get",
...>    caller: %Eigr.Functions.Protocol.Actors.ActorId{name: "robert", system: "actor-system"}
...> }
...> )
true