In this short guide, you’ll learn how to represent a concentric relationships.For example, if you want to have all editors of a document also be viewers of said document.
With the current type definition, there isn’t a way to indicate that all editors of a certain document are also automatically viewers of that document. So for a certain user, in order to indicate that they can both edit and view a certain document, two relationship tuples need to be created (one for editor, and another for viewer).
Instead of creating two relationship tuples, we can leverage concentric relationships by defining editors are viewers.Our authorization model becomes the following:
viewer of a document are any of:
users that are directly assigned as viewer
users that have editor of the document
With this authorization model change, having an editor relationship with a certain document implies having a viewer relationship with that same document.
Since we had a relationship tuple that indicates that bob is an editor of document:meeting_notes.doc, this means bob is now implicitly a viewer of document:meeting_notes.doc.
If we now check: is bob a viewer of document:meeting_notes.doc? we would get the following:
NoteWhen creating relationship tuples for Auth0 FGA make sure to use unique ids for each object and user within your application domain. We’re using first names and simple ids to just illustrate an easy-to-follow example.