mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 21:43:02 +12:00
0b6d93c7c4
see included documentation for more information on how field policies work.
30 lines
530 B
Elixir
30 lines
530 B
Elixir
defmodule Ash.Test.Support.PolicySimple.Trip do
|
|
@moduledoc false
|
|
use Ash.Resource,
|
|
data_layer: Ash.DataLayer.Ets,
|
|
authorizers: [
|
|
Ash.Policy.Authorizer
|
|
]
|
|
|
|
ets do
|
|
private?(true)
|
|
end
|
|
|
|
policies do
|
|
policy action_type(:read) do
|
|
authorize_if(expr(car.users.id == ^actor(:id)))
|
|
end
|
|
end
|
|
|
|
actions do
|
|
defaults [:create, :read, :update, :destroy]
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
end
|
|
|
|
relationships do
|
|
belongs_to(:car, Ash.Test.Support.PolicySimple.Car)
|
|
end
|
|
end
|