Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!