[Erp5-report] r15383 - in /erp5/trunk/products/ERP5Type: ERP5Type.py RoleProviderBase.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jul 30 16:30:35 CEST 2007


Author: yusei
Date: Mon Jul 30 16:30:34 2007
New Revision: 15383

URL: http://svn.erp5.org?rev=15383&view=rev
Log:
Changed reindex timing and its priority to low. Now reindex after to update all role mappings.

Modified:
    erp5/trunk/products/ERP5Type/ERP5Type.py
    erp5/trunk/products/ERP5Type/RoleProviderBase.py

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=15383&r1=15382&r2=15383&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py Mon Jul 30 16:30:34 2007
@@ -423,7 +423,8 @@
       return factory_method(portal, id).propertyMap()
 
     security.declarePrivate('updateLocalRolesOnSecurityGroups')
-    def updateLocalRolesOnSecurityGroups(self, ob, user_name = None):
+    def updateLocalRolesOnSecurityGroups(self, ob, user_name=None,
+                                         reindex=True):
       """
         Assign Local Roles to Groups on object 'ob', based on Portal Type Role
         Definitions and "ERP5 Role Definition" objects contained inside 'ob'.
@@ -605,7 +606,8 @@
           ob.manage_addLocalGroupRoles(group, role_list)
           ob.manage_addLocalRoles(group, role_list)
       # Make sure that the object is reindexed
-      ob.reindexObjectSecurity()
+      if reindex:
+        ob.reindexObjectSecurity()
 
     # XXX compat. alias
     security.declareProtected(Permissions.ModifyPortalContent,

Modified: erp5/trunk/products/ERP5Type/RoleProviderBase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/RoleProviderBase.py?rev=15383&r1=15382&r2=15383&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/RoleProviderBase.py (original)
+++ erp5/trunk/products/ERP5Type/RoleProviderBase.py Mon Jul 30 16:30:34 2007
@@ -260,6 +260,8 @@
       """
       portal_catalog = self.portal_catalog
 
+      update_role_tag = "%s.%s" % (self.__class__.__name__, "updateRoleMapping")
+
       object_list = portal_catalog(portal_type = self.id, limit=None)
       # We need to use activities in order to make sure it will
       # work for an important number of objects
@@ -268,9 +270,17 @@
       object_path_list = [x.path for x in object_list]
       for i in xrange(0, object_list_len, 100):
         current_path_list = object_path_list[i:i+100]
-        portal_activities.activate(activity='SQLQueue')\
-              .callMethodOnObjectList(current_path_list, 
-                     'updateLocalRolesOnSecurityGroups')
+        portal_activities.activate(activity='SQLQueue',
+                                   priority=6,
+                                   tag=update_role_tag)\
+              .callMethodOnObjectList(current_path_list,
+                                      'updateLocalRolesOnSecurityGroups',
+                                      reindex=False)
+        portal_activities.activate(activity='SQLQueue',
+                                   priority=6,
+                                   after_tag=update_role_tag)\
+              .callMethodOnObjectList(current_path_list,
+                                      'reindexObjectSecurity')
 
       if REQUEST is not None:
         return self.manage_editRolesForm(REQUEST, 




More information about the Erp5-report mailing list