An Ash policy check that authorizes if the current actor has an active subscription to a specific price or one of multiple allowed prices.
Uses the actor snapshot and freshness rules of AshBilling.Checks.Subscribed.
Multi-item subscriptions are outside the synchronized local model; unsupported
updates retain the last supported state until application remediation.
Requires a valid, non-empty :price identifier or a non-empty list of non-empty
price identifiers. If :price is missing, nil, empty, whitespace-only, contains
invalid elements, or is not a string/list of strings, authorization fails closed (denies access).
Usage
policies do
# Single price
policy action(:pro_feature) do
authorize_if {AshBilling.Checks.HasPrice, price: "price_pro_tier"}
end
# Multiple allowed prices (e.g., Pro or Enterprise)
policy action(:pro_or_enterprise_feature) do
authorize_if {AshBilling.Checks.HasPrice, price: ["price_pro_tier", "price_enterprise_tier"]}
end
end
Summary
Functions
Callback implementation for Ash.Policy.Check.eager_evaluate?/0.
Callback implementation for Ash.Policy.Check.prefer_expanded_description?/0.
Callback implementation for Ash.Policy.Check.requires_original_data?/2.
Callback implementation for Ash.Policy.Check.strict_check/3.
Callback implementation for Ash.Policy.Check.type/0.
Functions
Callback implementation for Ash.Policy.Check.eager_evaluate?/0.
Callback implementation for Ash.Policy.Check.prefer_expanded_description?/0.
Callback implementation for Ash.Policy.Check.requires_original_data?/2.
Callback implementation for Ash.Policy.Check.strict_check/3.
Callback implementation for Ash.Policy.Check.type/0.