security:authorization:openfga:authorization-model:keyword-vs-name
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| security:authorization:openfga:authorization-model:keyword-vs-name [2026/07/09 04:32] – phong2018 | security:authorization:openfga:authorization-model:keyword-vs-name [2026/07/09 04:36] (current) – phong2018 | ||
|---|---|---|---|
| Line 67: | Line 67: | ||
| DEFINE <your relation name>: [< | DEFINE <your relation name>: [< | ||
| </ | </ | ||
| - | |||
| - | |||
| - | ===== More examples to read ===== | ||
| - | |||
| - | The trick to reading a relation is to say it out loud in plain words. Below, the | ||
| - | left side is the DSL, the right side is how you say it. | ||
| - | |||
| - | ==== Direct grant ==== | ||
| - | |||
| - | < | ||
| - | define owner: [user] | ||
| - | </ | ||
| - | |||
| - | Read it as: **"a user can be assigned as the owner." | ||
| - | Keyword: '' | ||
| - | |||
| - | ==== Union with '' | ||
| - | |||
| - | < | ||
| - | define editor: [user] or owner | ||
| - | </ | ||
| - | |||
| - | Read it as: **"an editor is a user assigned directly, //or// anyone who is already | ||
| - | an owner." | ||
| - | So every owner is also an editor, for free. | ||
| - | |||
| - | ==== More than one allowed type ==== | ||
| - | |||
| - | < | ||
| - | define member: [user, group# | ||
| - | </ | ||
| - | |||
| - | Read it as: **"a member can be a single user, //or// every member of a group." | ||
| - | The comma lists two allowed types. '' | ||
| - | |||
| - | ==== Public access with a wildcard ==== | ||
| - | |||
| - | < | ||
| - | define viewer: [user:*] | ||
| - | </ | ||
| - | |||
| - | Read it as: **" | ||
| - | The '' | ||
| - | |||
| - | ==== Both must be true with '' | ||
| - | |||
| - | < | ||
| - | define can_delete: owner and admin | ||
| - | </ | ||
| - | |||
| - | Read it as: **"you can delete only if you are //both// an owner //and// an admin." | ||
| - | '' | ||
| - | |||
| - | ==== Take away with '' | ||
| - | |||
| - | < | ||
| - | define viewer: [user] but not blocked | ||
| - | </ | ||
| - | |||
| - | Read it as: **"a viewer is any assigned user, //except// anyone who is blocked." | ||
| - | '' | ||
| - | |||
| - | ==== Inherit through a link with '' | ||
| - | |||
| - | < | ||
| - | define viewer: viewer from parent | ||
| - | </ | ||
| - | |||
| - | Read it as: **"you can view this if you are a viewer of its parent." | ||
| - | Follow the '' | ||
| - | |||
| - | ==== Everything combined ==== | ||
| - | |||
| - | < | ||
| - | define viewer: [user] or editor or viewer from parent | ||
| - | </ | ||
| - | |||
| - | Read it as: **"a viewer is a user assigned directly, //or// an editor, //or// a | ||
| - | viewer of the parent folder." | ||
| - | This is the common real-world pattern: direct people, higher roles, and inherited | ||
| - | folder access all at once. | ||
| - | |||
| - | ===== Quick reading table ===== | ||
| - | |||
| - | ^ DSL ^ Read it as ^ | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | | '' | ||
| - | |||
| - | <note tip> | ||
| - | Rule of thumb: '' | ||
| - | name means a // | ||
| - | </ | ||
| ===== The keywords as concepts ===== | ===== The keywords as concepts ===== | ||
| Line 280: | Line 183: | ||
| </ | </ | ||
| - | ===== See also ===== | + | ===== More examples to read ===== |
| - | | + | The trick to reading a relation is to say it out loud in plain words. Below, the |
| - | * [[security:authorization:openfga:relationship-tuples|Relationship tuples]] | + | left side is the DSL, the right side is how you say it. |
| + | |||
| + | ==== Direct grant ==== | ||
| + | |||
| + | < | ||
| + | define owner: [user] | ||
| + | </ | ||
| + | |||
| + | Read it as: **"a user can be assigned as the owner." | ||
| + | Keyword: '' | ||
| + | |||
| + | ==== Union with '' | ||
| + | |||
| + | < | ||
| + | define editor: | ||
| + | </ | ||
| + | |||
| + | Read it as: **"an editor is a user assigned directly, //or// anyone who is already | ||
| + | an owner." | ||
| + | So every owner is also an editor, for free. | ||
| + | |||
| + | ==== More than one allowed type ==== | ||
| + | |||
| + | < | ||
| + | define member: | ||
| + | </ | ||
| + | |||
| + | Read it as: **"a member can be a single user, //or// every member of a group." | ||
| + | The comma lists two allowed types. '' | ||
| + | |||
| + | ==== Public access with a wildcard ==== | ||
| + | |||
| + | < | ||
| + | define viewer: [user:*] | ||
| + | </ | ||
| + | |||
| + | Read it as: **" | ||
| + | The '' | ||
| + | |||
| + | ==== Both must be true with '' | ||
| + | |||
| + | < | ||
| + | define can_delete: owner and admin | ||
| + | </ | ||
| + | |||
| + | Read it as: **"you can delete only if you are //both// an owner //and// an admin." | ||
| + | '' | ||
| + | |||
| + | ==== Take away with '' | ||
| + | |||
| + | < | ||
| + | define viewer: | ||
| + | </ | ||
| + | |||
| + | Read it as: **"a viewer is any assigned user, //except// anyone who is blocked." | ||
| + | '' | ||
| + | |||
| + | ==== Inherit through a link with '' | ||
| + | |||
| + | < | ||
| + | define viewer: viewer from parent | ||
| + | </ | ||
| + | |||
| + | Read it as: **"you can view this if you are a viewer of its parent." | ||
| + | Follow the '' | ||
| + | |||
| + | ==== Everything combined ==== | ||
| + | |||
| + | < | ||
| + | define viewer: [user] or editor or viewer from parent | ||
| + | </ | ||
| + | |||
| + | Read it as: **"a viewer is a user assigned directly, //or// an editor, //or// a | ||
| + | viewer of the parent folder." | ||
| + | This is the common real-world pattern: direct people, higher roles, and inherited | ||
| + | folder access all at once. | ||
| + | |||
| + | ===== Quick reading table ===== | ||
| + | |||
| + | ^ DSL ^ Read it as ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | <note tip> | ||
| + | Rule of thumb: '' | ||
| + | name means a // | ||
| + | </ | ||
| ===== See also ===== | ===== See also ===== | ||
| Line 289: | Line 283: | ||
| * [[security: | * [[security: | ||
| * [[security: | * [[security: | ||
| - | |||
security/authorization/openfga/authorization-model/keyword-vs-name.1783571536.txt.gz · Last modified: by phong2018
