Skip to content

rule

rule<R>(fn): Rule<R>

Defined in: packages/schema/src/access/rule.ts:26

Wraps an access function so it combines with others through .and() and .or(); roles.can() and roles.is() return such rules already.

R = any

AccessFn<R>

Rule<R>

const notShipped = rule((ctx, order) => order?.status !== 'shipped')
resource('orders').access({ update: notShipped.and(roles.can('orders.update')) })