瀏覽代碼

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