Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
How to manage user permissions relative to a group?

Lets take an abstract domain where user can create groups, invite other users and assign permissions within these groups.

Schematically it looks like this

[
  {
    "groupId": 1,
    "name": "Group 1",
    "users": [
       { "id": 1, "name": "User 1", "permissions": ["A", "B", "C"] }, // same
       { "id": 2, "name": "User 2", "permissions": ["A", "B"] }
       { "id": 3, "name": "User 3", "permissions": ["C"] }
    ]
  },
  {
    "groupId": 2,
    "name": "Group 2",
    "users": [
       { "id": 4, "name": "User 4", "permissions": ["A", "B", "C"] },
       { "id": 5, "name": "User 5", "permissions": ["A", "B"] }
       { "id": 1, "name": "User 1", "permissions": ["C"] } // same
    ]
  }
]

There are 5 users in the app (from 1 to 5). Each of the users has permissions within their group (A, B, C).

The question is: Where to store this permission on the web-client?

I use React.js + Node.js and manage my authentication via JWT. Is it okay to have an object in user's JWT which stores permissions per group. Something like this

Fake-JWT

{
  "userId": 1,
  "groups": [ 
    { "groupId": 1, "permissions": ["A", "B", "C"]  },
    { "groupId": 2, "permissions": ["C"]  }
  ]
}

I also expects to update user permissions on the fly without logging out the user

Any suggestion of how to do it correctly?

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

If your authorization rules (roles) is getting to complicated, then it can be wise to consider using the claim based authorization approach instead.

I think this SO question is a good starting point:

  • Role Based Authorization vs. Claim Based Authorization
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda