Django Active Directory Backend No Attribute __getitem__
Solution 1:
It is not your fault, the TypeError message you got is not very informative.
This particular snippet requires you to mirror your relevant AD groups in Django (you must create the same groups in Django using the admin). The groups should not have the same name, instead, the following convention is used (from a comment in the source):
Our AD groups were mirrored with the Django groups but prefaced with "ID " (notice the space)
If your Django group is named "ITsupport" then your AD group must be called "ID ITsupport" and so on.
If you want to modify this behavior, you must change the regular expression at line 142:
re.compile(r'^CN=ID (?P<groupName>[\w|\d|\s]+),')
For example:
re.compile(r'^CN=(?P<groupName>MyADGroup|MyOtherAdGroup|AndSoOn),')
Just replace the original expression with a list of your AD groups separated by a pipe (|
). You still have to create the groups using the Django admin or the shell.
Post a Comment for "Django Active Directory Backend No Attribute __getitem__"