[Erp5-report] r13969 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: ExtensionTemplateI...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 5 13:18:45 CEST 2007


Author: jerome
Date: Thu Apr  5 13:18:44 2007
New Revision: 13969

URL: http://svn.erp5.org?rev=13969&view=rev
Log:
use unrestrictedSearchResults in getSecurityCategoryFromAssignment, because the
currently logged in user may not be able to find the corresponding person in
the catalog.
(For Python Scripts, we need proxy roles)


Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py?rev=13969&r1=13968&r2=13969&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py Thu Apr  5 13:18:44 2007
@@ -25,6 +25,8 @@
 #
 ##############################################################################
 
+from Products.ERP5Security.ERP5GroupManager import ConsistencyError
+
 def getSecurityCategoryFromAssignment(self, base_category_list, user_name, object, portal_type, child=0):
   """
   This script returns a list of dictionaries which represent
@@ -49,13 +51,8 @@
   
   category_list = []
   
-  # Get the Person module
-  person_module = context.portal_url.getPortalObject().getDefaultModule('Person')
-  
-  # It is better to keep getObject(), in this script this
-  # prevent a very strange bug, sometimes without getObject the
-  # assignment is not found
-  person_object_list = [x.getObject() for x in person_module.searchFolder(portal_type='Person', reference=user_name)]
+  person_object_list = self.portal_catalog.unrestrictedSearchResults(
+                                portal_type='Person', reference=user_name)
   
   if len(person_object_list) != 1:
     if len(person_object_list) > 1:
@@ -65,7 +62,7 @@
       # this happens for example when a manager with no associated person object
       # creates a person_object for a new user
       return []
-  person_object = person_object_list[0]
+  person_object = person_object_list[0].getObject()
   
   # We look for every valid assignments of this user
   for assignment in person_object.contentValues(filter={'portal_type': 'Assignment'}):

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=13969&r1=13968&r2=13969&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Thu Apr  5 13:18:44 2007
@@ -1,1 +1,1 @@
-290
+291




More information about the Erp5-report mailing list