ash/test/support/policy_simple/resources/foo.ex

33 lines
648 B
Elixir

defmodule Ash.Test.Support.PolicySimple.Foo do
@moduledoc false
use Ash.Resource,
domain: Ash.Test.Support.PolicySimple.Domain,
data_layer: Ash.DataLayer.Ets,
authorizers: [
Ash.Policy.Authorizer
]
policies do
policy action_type(:create) do
authorize_if(changing_attributes(name: [to: "Foo"]))
end
policy action_type(:read) do
authorize_if(always())
end
end
ets do
private?(true)
end
attributes do
uuid_primary_key(:id)
attribute(:name, :string, public?: true)
end
actions do
default_accept :*
defaults [:read, :destroy, create: :*, update: :*]
end
end