Commit acc83886 authored by Alexandre Boeglin's avatar Alexandre Boeglin

we want to prevent duplicated user ids, but only when PAS _AND_

ERP5UserManager are used.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6183 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb1f2b34
...@@ -36,6 +36,12 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface ...@@ -36,6 +36,12 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Utils import assertAttributePortalType from Products.ERP5Type.Utils import assertAttributePortalType
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
try:
from Products import PluggableAuthService
from Products.ERP5Security import ERP5UserManager
except ImportError:
PluggableAuthService = None
class Person(Entity, Node, XMLObject): class Person(Entity, Node, XMLObject):
...@@ -149,11 +155,18 @@ class Person(Entity, Node, XMLObject): ...@@ -149,11 +155,18 @@ class Person(Entity, Node, XMLObject):
- we want to apply a different permission - we want to apply a different permission
- we want to prevent duplicated user ids - we want to prevent duplicated user ids, but only when
PAS _AND_ ERP5UserManager are used
""" """
if value: if value:
user_list = self.acl_users.searchUsers(id = value, exact_match = True) if PluggableAuthService is not None:
if len(user_list) > 0: plugin_list = self.acl_users.plugins.listPlugins(
raise RuntimeError, 'user id %s already exist' % (value,) PluggableAuthService.interfaces.plugins.IUserEnumerationPlugin)
for plugin_name, plugin_value in plugin_list:
if isinstance(plugin_value, ERP5UserManager):
user_list = self.acl_users.searchUsers(id = value, exact_match = True)
if len(user_list) > 0:
raise RuntimeError, 'user id %s already exist' % (value,)
break
self._setReference(value) self._setReference(value)
self.reindexObject() self.reindexObject()
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