[Erp5-report] r6488 - /erp5/trunk/products/ERP5Type/CopySupport.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 6 20:01:38 CEST 2006
Author: alex
Date: Thu Apr 6 20:01:04 2006
New Revision: 6488
URL: http://svn.erp5.org?rev=6488&view=rev
Log:
Fixed a copy&paste bug :
Zope only updates the Owner local role after pasting if no local role has
already been defined on the object, which breaks ERP5Security.
Modified:
erp5/trunk/products/ERP5Type/CopySupport.py
Modified: erp5/trunk/products/ERP5Type/CopySupport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CopySupport.py?rev=6488&r1=6487&r2=6488&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CopySupport.py (original)
+++ erp5/trunk/products/ERP5Type/CopySupport.py Thu Apr 6 20:01:04 2006
@@ -207,6 +207,22 @@
self_base = aq_base(self)
portal_catalog = getToolByName(self, 'portal_catalog')
self_base.uid = portal_catalog.newUid()
+
+ # Give the Owner local role to the current user, zope only does this if no
+ # local role has been defined on the object, which breaks ERP5Security
+ if hasattr(self_base, '__ac_local_roles__'):
+ user=getSecurityManager().getUser()
+ if user is not None:
+ userid=user.getId()
+ if userid is not None:
+ #remove previous owners
+ dict = self.__ac_local_roles__
+ for key, value in dict.items():
+ if 'Owner' in value:
+ value.remove('Owner')
+ #add new owner
+ l=dict.setdefault(userid, [])
+ l.append('Owner')
# Clear the transaction references
# THIS IS NOT GENERIC ENOUGH - PROPERTY SHEET EXTENSION REQUIRED
More information about the Erp5-report
mailing list