1

Hello again every one,

I have a question: I successfully implemented django-auth-ldap, the LDAP users can request successfully my DRF API. But nows, for my projetc needs, I have to define permissions depending of the group.

Indeed, I will have like 12 groups in my app. Depending of the group, I will authorize or not the user to request a given route, BUT even if I defined the global var AUTH_LDAP_MIRROR_GROUPS = True, and saw in my database the are linked to a group (see capture):

Users in database

Groups from LDAP inserted in db thx to django-auth_ldap settings

User linked to the groups defined

But now, I have some other problems: I do not know how to implement permissions depending of the group the user belong. In fact, if a user belong to the group ServerAdministrator, I want to allow him to access to every route accessible, but I dont know where to see this in the received request in my view?

As I understood, I should implement custom permissions I should write programmatically in a User object (which should inherit from django AbstractUser)

If yes, How does it work? Should I empty my whole Database and then let django-auth-ldap insert users and it also will create the given permissions defined inside the database?

Maybe it is not clear, do not hesitate to ask questions if I can be more precise.

Kind regards.

Benjamin

0 Answers0