Skip to content

Commit

Permalink
Merge branch 'sainati/entitlement-docs' of github.com:onflow/docs int…
Browse files Browse the repository at this point in the history
…o sainati/entitlement-docs
  • Loading branch information
dsainati1 committed Jul 14, 2023
2 parents 21d8c0c + 0e944c1 commit 2ae6f19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/cadence/language/access-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,12 @@ Entitlement
let alsoEntitledSubRef = r.getRef()
```

<!---- TODO: Update once mappings can be used on regular composite fields ---->
{/* 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 --->
{/* 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.
Expand Down
4 changes: 2 additions & 2 deletions docs/cadence/language/references.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2ae6f19

Please sign in to comment.