-
Notifications
You must be signed in to change notification settings - Fork 41
Clarify how arrows operate over subject relations #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1bd3fab
to
77eb6f1
Compare
77eb6f1
to
ee7f00e
Compare
@@ -38,8 +38,9 @@ definition someobjecttype {} | |||
``` | |||
|
|||
<Callout type="info"> | |||
Note that the examples are unprefixed. | |||
You'll need to add the prefix from your permissions system if calling `WriteSchema` for a permissions system hosted in Serverless. | |||
Note that the examples are unprefixed. You'll need to add the prefix from your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fix this in a followup when we add the linter?
@@ -105,7 +107,8 @@ definition group { | |||
``` | |||
|
|||
<Callout type="info"> | |||
Subject Relations are useful in RBAC-style permissions systems to grant "roles" to _sets_ of subjects, such as the members of a team. | |||
Subject Relations are useful in RBAC-style permissions systems to grant | |||
"roles" to _sets_ of subjects, such as the members of a team. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
Be **very careful** with wildcard support in your schema! | ||
**Only** grant it to read permissions, unless you intend to allow for universal writing. | ||
Be **very careful** with wildcard support in your schema! **Only** grant it to | ||
read permissions, unless you intend to allow for universal writing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
of relations. This allows for easy nested computation, and is more readable. | ||
It is _recommended_ that the right side of all arrows refer to | ||
**permissions**, instead of relations, as this allows for easy nested | ||
computation, and is more readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
<Callout type="warning"> | ||
Arrows operate on the **object** of the subject(s) found on a `relation`. They | ||
*do not* operate on the relation/permission of a subject, *even if the subject | ||
refers to a relation or permission*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
`parent->something` refers to the `something` permission on the **group**, and `#member` will be ignored for the arrow. | ||
|
||
It is recommended to not use arrows over relations that allow for subject relations without noting that | ||
fact via a comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
Why is this the case? In one word: **performance**. If arrows operated over | ||
the subject's relation or permission, a full LookupSubjects call would be | ||
necessary for the arrow to correctly "walk", which would make these | ||
CheckPermission requests potentially *incredibly* expensive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
You'll note that we also used `member` above in the relation example. Defining | ||
`member` as a **permission** might be found when you have multiple "ways" a | ||
subject can be a member of a resource, thus changing it from a simple relation | ||
to a _computed_ set of subjects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
</Callout> | ||
|
||
## Comments | ||
|
||
### Documentation Comments | ||
|
||
<Callout type="info"> | ||
It is **highly** recommended to put doc comments on all definitions, relations and permissions. | ||
It is **highly** recommended to put doc comments on all definitions, relations | ||
and permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
|
||
<Callout type="info"> | ||
Note that since `parent->read` calls the same `read` permission, it will form a recursive lookup across the chain of parent folder(s). | ||
Note that since `parent->read` calls the same `read` permission, it will form | ||
a recursive lookup across the chain of parent folder(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one sentence per line, need a linter for this
No description provided.