Skip to content

Commit

Permalink
Merge pull request #57 from onflow/sainati/disjunction-entitlement
Browse files Browse the repository at this point in the history
Add example for reference with disjoint entitlement set
  • Loading branch information
dsainati1 committed Mar 8, 2024
2 parents 38ff827 + 6282a96 commit dd455bf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion versioned_docs/version-1.0/language/access-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ let r: @SomeResource = // ...
let refE: auth(E) &SomeResource = // ...
let refF: auth(F) &SomeResource = // ...
let refEF: auth(E, F) &SomeResource = // ...
let refEOrF: auth(E | F) &SomeResource = // ...
```

The references can be used as follows:
Expand Down Expand Up @@ -322,10 +323,19 @@ refEF.a
refEF.b
// valid, because `refEF` has both of the two required entitlements
refEF.c
// invalid, because `refEOrF` might not have an `E` entitlement (it may have `F` instead)
refEOrF.a
// valid, because `refEOrF` has one of the two entitlements necessary
refEOrF.b
// invalid, because `refEOrF` is only known to have one of the two required entitlements
refEOrF.c
```

Note particularly in this example how the owned value `r` can access all entitled members on `SomeResource`.
Owned values are not affected by entitled declarations.
Owned values are not affected by entitled declarations.

Further details about authorized references can be found [here](./references.mdx#authorized-references).

### Entitlement mappings

Expand Down

0 comments on commit dd455bf

Please sign in to comment.