DEV Community


Discussion on: Dynamic Group based LDAP authentication with django and RegEx

lquenti profile image
Lars Quentin Author

If I understand you correctly:

Hide Content:

  • Dynamically create the group as done above.
  • Pass the groups to the view renderer
  • Exclude the code based on conditionals with the django templating engine / Jinja2

Permit View:
Probably the cleanest way would be to create a decorator with functools.wraps.
In this decorator you'd get the group from the request and then permit or deny based on the group names.