Setting Access Rules
A single, unified system is responsible for controlling what authority is required to access a method call or a specific resource action. In both cases, you create an AccessRule which specifies a boolean condition based on the presence of all visible Proofs.
Here is a list of the available rules:
Rule | Description |
---|---|
require(single resource) |
TRUE if the specified resource is present |
require_any_of(list of resources) |
TRUE if any resource in the list is present |
require_all_of(list of resources) |
TRUE if every resource in the list is present |
require_n_of(n, list_of_resources) |
TRUE if at least n resources in the list are present |
require_amount(quantity, single resource) |
TRUE if the specified resource is present in at least the given quantity |
allow_all |
TRUE always |
deny_all |
FALSE always |
The resources (or resource lists) may either be specified statically (giving exact resource addresses) or may be references to variables in the component.
Multiple rules may be combined with logical operators &&
and ||
, and nested within ()
. There is no logical "not" operator.