OptimumCredo.Check.Warning.AshCallWithoutActor (OptimumCredo v0.5.0)

View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of low and works with any version of Elixir.

Explanation

Pass the actor to Ash calls so policies can authorize them.

Bad

Ash.read!(MyApp.Blog.Post)

Good

Ash.read!(MyApp.Blog.Post, actor: current_user, tenant: tenant)

Set ash: true to enable the check. Queries and changesets that already carry the actor are not analysed.

Check-Specific Parameters

Use the following parameters to configure this check:

:ash

Enable the Ash heuristics (default false).

This parameter defaults to false.

:actorless_resources

Resource modules that do not need an actor.

This parameter defaults to [].

:resource_modules

Modules whose functions are Ash code interfaces.

This parameter defaults to [].

:ash_functions

Ash functions to inspect.

This parameter defaults to [:get, :get!, :read, :read!, :read_one, :read_one!, :create, :create!, :update, :update!, :destroy, :destroy!, :load, :load!, :count, :count!, :exists?, :bulk_create, :bulk_create!, :bulk_update, :bulk_update!, :bulk_destroy, :bulk_destroy!].

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.