[Erp5-report] r6909 - /erp5/trunk/products/ERP5/Document/Person.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Apr 24 16:57:03 CEST 2006


Author: jerome
Date: Mon Apr 24 16:57:01 2006
New Revision: 6909

URL: http://svn.erp5.org?rev=6909&view=rev
Log:
check the type of acl_users rather than the availability of PluggableAuthService to decide wether we should allow duplicate reference

Modified:
    erp5/trunk/products/ERP5/Document/Person.py

Modified: erp5/trunk/products/ERP5/Document/Person.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Person.py?rev=6909&r1=6908&r2=6909&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Person.py (original)
+++ erp5/trunk/products/ERP5/Document/Person.py Mon Apr 24 16:57:01 2006
@@ -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 @@
           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')




More information about the Erp5-report mailing list