Преглед изворни кода

HUE-2436 [useradmin] Django-1.6: Stop caching the user in the session

This process of caching the user object in the session no longer works.
Since we don't ever actually access this cached user, we can just store
a boolean to mark that we've imported this user.
Erick Tryzelaar пре 11 година
родитељ
комит
e965d3ed1b
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      apps/useradmin/src/useradmin/middleware.py

+ 4 - 1
apps/useradmin/src/useradmin/middleware.py

@@ -52,5 +52,8 @@ class LdapSynchronizationMiddleware(object):
         connection = ldap_access.get_connection_from_server(next(LDAP.LDAP_SERVERS.__iter__()))
       else:
         connection = ldap_access.get_connection_from_server()
-      request.session[self.USER_CACHE_NAME] = import_ldap_users(connection, user.username, sync_groups=True, import_by_dn=False)
+
+      import_ldap_users(connection, user.username, sync_groups=True, import_by_dn=False)
+
+      request.session[self.USER_CACHE_NAME] = True
       request.session.modified = True