elixir
[...]
multitenancy do
strategy :attribute
attribute :tenant_id
end
[...]
relationships do
belongs_to :tenant, Api.Tenants.Tenant,
allow_nil?: false,
attribute_type: :uuid,
public?: true
belongs_to :image_file, Api.Files.File, allow_nil?: true, attribute_type: :uuid, public?: true
end
actions do
[...]
create :create do
accept([:name, :description, :address, :image_file_id])
end
[...]
end
policies do
[...]
policy action(:create) do
# does this override multitenancy?
authorize_if always()
# authorize_if Api.Policies.ActorInTenant
end
[...]
end
elixir
[...]
multitenancy do
strategy :attribute
attribute :tenant_id
end
[...]
relationships do
belongs_to :tenant, Api.Tenants.Tenant,
allow_nil?: false,
attribute_type: :uuid,
public?: true
belongs_to :image_file, Api.Files.File, allow_nil?: true, attribute_type: :uuid, public?: true
end
actions do
[...]
create :create do
accept([:name, :description, :address, :image_file_id])
end
[...]
end
policies do
[...]
policy action(:create) do
# does this override multitenancy?
authorize_if always()
# authorize_if Api.Policies.ActorInTenant
end
[...]
end