Configuring Data and Permission Associations in Strapi: Using Admin Panel or Custom Code?

44 Views Asked by At

After creating an API using Strapi, I want to associate data in a table with permissions, so that users with different roles can access different data through the API. How can I configure this using the admin panel? If I need to implement it through code, do I have to write custom find queries for each table? Are there any plugins available to achieve this functionality?

I created a router table in Strapi. Strapi automatically generates the '/api/routers' endpoint. After the user logs in, I will call the '/api/auth/local' endpoint to get the JWT. Then, the program will automatically call the '/api/routers' endpoint and include the JWT in the Authorization header as a bearer token. What I expect is to receive the router data for the current user's role, but I'm not sure what to do next.

1

There are 1 best solutions below

1
mainak On BEST ANSWER

you have to write custom codes and manage tables based on the role, store the user based roles in user-permissions table and while adding data check the user permissions