I am building a web app using Django 3.0.7 and Python 3.8 that will use some business intelligence tool, like Tableau or Power BI, as a reporting source.
There is absolutely no issue with the code I am using, however I need to be able to reduce visibility to certain pages, based on a created group. For example:
If I have three pages/dashboards:
127.0.0.1:8000/director/report1
, 127.0.0.1:8000/manager/report2
, 127.0.0.1:8000/employee/report3
and I have three users:
Director
, Manager
, Employee
How can I create the site in such a way that when a user registers to the site, their profile is created and subsequently assigned a group THEN restrict access to certain pages based on the user group (this would be easier than assigning permission to every user). For example:
The user Director would belong to a group called, directors
, and would have access to 127.0.0.1:8000/director/report1
, 127.0.0.1:8000/manager/report2
, 127.0.0.1:8000/employee/report3
.
The user Manager would belong to a group called, managers
, and have access to 127.0.0.1:8000/manager/report2
, 127.0.0.1:8000/employee/report3
.
The user Employee would belong to a group called, employees
, and have access to 127.0.0.1:8000/employee/report3
.
I found some information related to permissions here: https://docs.djangoproject.com/en/2.1/_modules/django/contrib/auth/decorators/ but I cannot find information related to creating groups AND assigning permissions.