Skip to content

Inherence permissions for roles #230

Closed Answered by jon-whit
ofeksher asked this question in Q&A
Discussion options

You must be logged in to vote
model
  schema 1.1

type user

type role
  relations
    define child: [role]
    define member: [user] or member from child
    
type document
  relations
    define editor: [role#member]
- role:2#child@role:1
- document:exp#editor@role:2#member
- role:1#member@user:jon

Check(document:1#editor@user:jon) returns {allowed: true} because user:jon is a member of role:1 and role:1 is a child of role:2 and role:2 has editor on document:exp. Here's a sample Playground link that demonstrates this.

https://play.fga.dev/stores/create/?id=01HGV3YREXM5KDMJYD72K5FMD3

NOTE: OpenFGA models relationships as a directed graph. So if you want parent and child relationships you have to create these indivi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ofeksher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #229 on December 04, 2023 18:46.