Commit a4d70f13 authored by Jérome Perrin's avatar Jérome Perrin

check the type of acl_users rather than the availability of...

check the type of acl_users rather than the availability of PluggableAuthService to decide wether we should allow duplicate reference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6909 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cdab311e
......@@ -28,6 +28,7 @@
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5.Core.Node import Node
from Products.ERP5.Document.Entity import Entity
......@@ -163,13 +164,15 @@ class Person(Entity, Node, XMLObject):
PAS _AND_ ERP5UserManager are used
"""
if value:
if PluggableAuthService is not None:
plugin_list = self.acl_users.plugins.listPlugins(
acl_users = getToolByName(self, 'acl_users')
if PluggableAuthService is not None and isinstance(acl_users,
PluggableAuthService.PluggableAuthService.PluggableAuthService):
plugin_list = acl_users.plugins.listPlugins(
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)
user_list = acl_users.searchUsers(id=value,
exact_match=True)
if len(user_list) > 0:
raise RuntimeError, 'user id %s already exist' % (value,)
break
......
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