How can I create authorization with dinamic roles in a Django backend, with the frontend built in React?

I am creating a system that implements authentication and authorization with React in the Frontend and Django. But Ich must implement dinamic roles and don't find how to make authorization in the backend, just in the front.

How could I make that? I store the menu elements of the front in the database and based on the role the user create show those elements. But all the enpoints are accessible in the API for a user who have valid credentials for authentication. I'm using simple-jwt and django-restframework.

A middleware that'd store the authenticated user and his roles it's something I think would be close to the answer but don't know how to implement it either.

I hope someone can help me. Thanks in advance.

Back to Top