Commit 6c1a5927 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

ERP5SecurityManager: Use _person_cache in request to store path of user

parent c1958228
...@@ -120,7 +120,7 @@ class ERP5UserManager(BasePlugin): ...@@ -120,7 +120,7 @@ class ERP5UserManager(BasePlugin):
def getPersonByReference(self, reference): def getPersonByReference(self, reference):
def _getPersonRelativeUrlFromReference(reference): def _getPersonRelativeUrlFromReference(reference):
person_url = self.REQUEST.get('_login_cache', {}).get(reference) person_url = self.REQUEST.get('_person_cache', {}).get(reference)
portal = self.getPortalObject() portal = self.getPortalObject()
if person_url is not None: if person_url is not None:
return person_url return person_url
...@@ -241,6 +241,10 @@ class ERP5UserManager(BasePlugin): ...@@ -241,6 +241,10 @@ class ERP5UserManager(BasePlugin):
# authentication policy enabled, we need person object anyway # authentication policy enabled, we need person object anyway
login = self.getPortalObject().unrestrictedTraverse(login_url) login = self.getPortalObject().unrestrictedTraverse(login_url)
if login and '_person_cache' not in self.REQUEST:
self.REQUEST.set('_person_cache', {})
self.REQUEST['_person_cache'][user_reference] = login.getParent()
if user_reference is None: if user_reference is None:
# file a failed authentication attempt # file a failed authentication attempt
login.notifyLoginFailure() login.notifyLoginFailure()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment