diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index 491373b2eea64762cf406cf0f66b275b55cbd169..3f8345da44da38ea4ba2becada64330e2cdd5ca8 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -235,6 +235,10 @@ if _settings.get("ldap.uri", None): if _dn: AUTH_LDAP_USER_FLAGS_BY_GROUP[_flag] = _dn + # Backend admin requires superusers to also be staff members + if "is_superuser" in AUTH_LDAP_USER_FLAGS_BY_GROUP and "is_staff" not in AUTH_LDAP_USER_FLAGS_BY_GROUP: + AUTH_LDAP_USER_FLAGS_BY_GROUP["is_staff"] = AUTH_LDAP_USER_FLAGS_BY_GROUP["is_superuser"] + # Add ModelBckend last so all other backends get a chance # to verify passwords first AUTHENTICATION_BACKENDS.append("django.contrib.auth.backends.ModelBackend")