Преглед на файлове

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 години
родител
ревизия
e965d3e
променени са 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