OrderByCodeAccessStrategy
The OrderByCodeAccessStrategy determines how access to a placed Order via the orderByCode query is granted. With a custom strategy anonymous access could be made permanent or tied to specific conditions like IP range or an Order status.
Example
This example grants access to the requested Order to anyone – unless it's Monday.
Info
This is configured via the orderOptions.orderByCodeAccessStrategy property of
your VendureConfig.
- Extends:
InjectableStrategy
canAccessOrder
method
(ctx: RequestContext, order: Order) => boolean | Promise<boolean>Gives or denies permission to access the requested Order
The default OrderByCodeAccessStrategy used by Vendure. It permitts permanent access to the Customer owning the Order and anyone within a given time period after placing the Order (defaults to 2h).
- Implements:
OrderByCodeAccessStrategy
constructor
method
(anonymousAccessDuration: string) => DefaultOrderByCodeAccessStrategycanAccessOrder
method
(ctx: RequestContext, order: Order) => booleanWas this chapter helpful?