diff --git a/docs/cadence/language/access-control.md b/docs/cadence/language/access-control.md index 351368641c..24971385fe 100644 --- a/docs/cadence/language/access-control.md +++ b/docs/cadence/language/access-control.md @@ -389,11 +389,12 @@ Entitlement let alsoEntitledSubRef = r.getRef() ``` - +{/* TODO: Update once mappings can be used on regular composite fields */} + Entitlement mappings may be used either in accessor functions (as in the example above), or in fields whose types are references. Note that this latter usage will necessarily make the type of the composite non-storage, since it will have a reference field. - +{/* TODO: once the Account type refactor is complete and the documentation updated, let's link here to the Account type page as an example of more complex entitlement mappings */} Entitlement mappings need not be 1:1; it is valid to define a mapping where multiple inputs map to the same output, or where one input maps to multiple outputs. Entitlement mappings preserve the "kind" of the set they are mapping; i.e. mapping an "and" set produces an "and" set, and mapping an "or" set produces an "or" set. diff --git a/docs/cadence/language/references.mdx b/docs/cadence/language/references.mdx index abdc4cf230..38ccdb8508 100644 --- a/docs/cadence/language/references.mdx +++ b/docs/cadence/language/references.mdx @@ -129,7 +129,7 @@ Instead, consider [storing a capability and borrowing it](capability-based-acces ## Authorized References By default, references are **unauthorized**. -However, they may also be **authorized** to a set of [entitlements](./access-control.mdx#entitlements) +However, they may also be **authorized** to a set of [entitlements](./access-control.md#entitlements) Authorized references have the `auth` modifier, along with the set of entitlements to which they are authorized. The full syntax is: @@ -234,7 +234,7 @@ eOrFRef as auth(E, F) &T ### References and Entitlement Mappings -In most situations, an [entitlement mapping](./access-control.mdx#entitlement-mappings) is valid in the `auth` portion of a reference type. +In most situations, an [entitlement mapping](./access-control.md#entitlement-mappings) is valid in the `auth` portion of a reference type. However, in certain specific circumstances in the definition of a field or function on a composite type, an entitlement mapping may be used in an `auth` modifier. When a field is defined with an entitlement mapping: