From a4d70f13b6291b39c8541140af4f85fdf776b870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 24 Apr 2006 14:57:01 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/Person.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/Person.py b/product/ERP5/Document/Person.py index f45f1a0db3..f6de94762c 100644 --- a/product/ERP5/Document/Person.py +++ b/product/ERP5/Document/Person.py @@ -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,19 +164,21 @@ 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 self._setReference(value) self.reindexObject() - # invalid the cache for ERP5Security + # invalid the cache for ERP5Security clearCache() security.declareProtected(Permissions.SetOwnPassword, 'setPassword') -- 2.30.9