Commit ec667d3a authored by Vincent Pelletier's avatar Vincent Pelletier

Prevent getUserByLogin from failing due to a degraded catalog (for example if...

Prevent getUserByLogin from failing due to a degraded catalog (for example if it doesn't exist, ERP5Security prevents from accessing the managment screens to fix the situation).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11862 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 284b0deb
...@@ -25,6 +25,7 @@ from Products.PluggableAuthService.utils import classImplements ...@@ -25,6 +25,7 @@ from Products.PluggableAuthService.utils import classImplements
from Products.PluggableAuthService.interfaces.plugins import IAuthenticationPlugin from Products.PluggableAuthService.interfaces.plugins import IAuthenticationPlugin
from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlugin from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlugin
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from ZODB.POSException import ConflictError
from zLOG import LOG from zLOG import LOG
...@@ -173,9 +174,14 @@ class ERP5UserManager(BasePlugin): ...@@ -173,9 +174,14 @@ class ERP5UserManager(BasePlugin):
if sm.getUser() != SUPER_USER: if sm.getUser() != SUPER_USER:
newSecurityManager(self, self.getUser(SUPER_USER)) newSecurityManager(self, self.getUser(SUPER_USER))
try:
try: try:
result = self.getPortalObject().portal_catalog( result = self.getPortalObject().portal_catalog(
portal_type="Person", reference=login) portal_type="Person", reference=login)
except ConflictError:
raise
except:
LOG('ERP5Security', 0, 'getUserByLogin failed', error=sys.exc_info())
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
return [item.getObject() for item in result] return [item.getObject() for item in result]
......
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