Skip to content

How to model multi-tenancy where the same user (logged in user that is) can have multiple tenant-users, each with a different set of permissions? #446

Closed Answered by aaguiarz
OsmanMElsayed asked this question in Q&A
Discussion options

You must be logged in to vote

It seems that the permissions are defined at the user level, not principal level, right?

Do you want to confirm that the principal and the tenant-user that are in the JWT are actually linked somehow in OpenFGA?

Would this work?

# Adds support for Groups:
#   - Editors and Viewers can be assigned to groups
#   - Groups can be nested

model: |
  model
    schema 1.1
    
  type tenant-user

  type principal
    relations
        define user : [tenant-user]

  type tenant
    relations
        define can_write : [tenant-user]
        define principal_in_context: [principal]

        define reader : [tenant-user] and user from principal_in_context
        define writer : [tenant-user] and use…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@OsmanMElsayed
Comment options

@aaguiarz
Comment options

Answer selected by OsmanMElsayed
@OsmanMElsayed
Comment options

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