diff --git a/product/ERP5Security/ERP5UserManager.py b/product/ERP5Security/ERP5UserManager.py index aaf22cae6534db7aa8eba948de5589a8b829480c..e68161641338895b50667f93c0ae6e87c661d1d7 100644 --- a/product/ERP5Security/ERP5UserManager.py +++ b/product/ERP5Security/ERP5UserManager.py @@ -90,9 +90,15 @@ class ERP5UserManager(BasePlugin): user = user_list[0] - if pw_validate(user.getPassword(), password) and\ - user.getCareerRole() == 'internal': - return login, login # use same for user_id and login + sm = getSecurityManager() + if sm.getUser() != SUPER_USER: + newSecurityManager(self, self.getUser(SUPER_USER)) + try: + if pw_validate(user.getPassword(), password) and\ + user.getCareerRole() == 'internal': + return login, login # use same for user_id and login + finally: + setSecurityManager(sm) return None