-
Notifications
You must be signed in to change notification settings - Fork 8
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
Avoid duplicate everyone check #1327
Conversation
2bfa86e
to
7cb33ed
Compare
internal/jimm/utils.go
Outdated
) | ||
|
||
/** | ||
* Authorisation utilities | ||
**/ | ||
|
||
// EveryoneUser is a convenience method to retrieve the "everyone" user |
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.
nitpick: EveryoneIdentity?
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.
Bit torn on this, I think EveryoneUser conveys a better understanding when you read it.
1645376
to
6c6baf3
Compare
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.
ty for changing
* avoid duplicate everyone checks * make method not exported
Description
I noticed in many places we were checking a user's access to a resource and if they had no access, then checking the "everyone" user's access. This is not necessary because when the "everyone" user is granted access to a resource, OpenFGA transparently handles such cases. I.e. If "everyone" has access to a model, and we check whether Alice has access to that model, although she doesn't have a direct relation to the model, the check will return the "everyone" user's access level.
I also created a utility method on
jimm
to return the "everyone" user without requiring duplicated setup.See https://openfga.dev/docs/modeling/public-access for more info.