2022-07-22 02:19:47 +12:00
|
|
|
defmodule Ash.Test.Support.PolicyRbac.File do
|
2022-05-18 07:56:40 +12:00
|
|
|
@moduledoc false
|
|
|
|
use Ash.Resource,
|
|
|
|
data_layer: Ash.DataLayer.Ets,
|
|
|
|
authorizers: [Ash.Policy.Authorizer]
|
|
|
|
|
2022-07-22 02:19:47 +12:00
|
|
|
import Ash.Test.Support.PolicyRbac.Checks.RoleChecks, only: [can?: 1]
|
2022-05-18 07:56:40 +12:00
|
|
|
|
|
|
|
policies do
|
|
|
|
policy always() do
|
|
|
|
authorize_if(can?(:file))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
ets do
|
|
|
|
private?(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
actions do
|
|
|
|
defaults [:create, :read, :update, :destroy]
|
|
|
|
end
|
|
|
|
|
|
|
|
attributes do
|
|
|
|
uuid_primary_key(:id)
|
|
|
|
attribute(:name, :string)
|
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
2022-07-22 02:19:47 +12:00
|
|
|
belongs_to(:organization, Ash.Test.Support.PolicyRbac.Organization)
|
2022-05-18 07:56:40 +12:00
|
|
|
end
|
|
|
|
end
|