Hey, there
I’m trying to learn about Ash policies with this barebones resource.
defmodule ExampleApp.Resource do
use Ash.Resource,
authorizers: [Ash.Policy.Authorizer],
data_layer: :embedded
attributes do
uuid_primary_key :id
attribute :field, :string
end
policies do
policy always() do
forbid_if always()
end
end
actions do
defaults [:create, :read]
end
code_interface do
define_for ExampleApp.Api
define :create
end
end
If my understanding is correct, this policy is guaranteed to fail.
Yet, ExampleApp.Resource.create/2
always succeeds when I test it.
Any help on how I can understand or resolve this?
PS: I’m currently on 2.21.8
in case this has anything to do with the 3.0
changes.