[Erp5-report] r12392 - /erp5/trunk/products/ERP5/Tool/ContributionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 26 14:00:21 CET 2007


Author: bartek
Date: Fri Jan 26 14:00:12 2007
New Revision: 12392

URL: http://svn.erp5.org?rev=12392&view=rev
Log:
added listDAVObjects

Modified:
    erp5/trunk/products/ERP5/Tool/ContributionTool.py

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=12392&r1=12391&r2=12392&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py Fri Jan 26 14:00:12 2007
@@ -30,7 +30,7 @@
 import string
 import pdb
 
-from AccessControl import ClassSecurityInfo
+from AccessControl import ClassSecurityInfo, getSecurityManager
 from Globals import InitializeClass, DTMLFile
 from Products.ERP5Type.Tool.BaseTool import BaseTool
 from Products.ERP5Type import Permissions
@@ -326,6 +326,21 @@
 
     return BaseTool._delOb(self, id)
 
+  def listDAVObjects(self):
+   """
+     Get all docs contributed by the current user
+     XXX you can only list them this way, but they're not accessible
+     to make it fully usable we should set their id's with module name
+     and possibly something nicer to display
+   """
+   sm = getSecurityManager()
+   u = sm.getUser()
+   kw = {}
+   res = self.portal_catalog(portal_type=self.getPortalDocumentTypeList())
+   res = [r.getObject() for r in res]
+   res = [o for o in res if u.allowed(o, ('Owner',))] # XXX terrible - needs to use portal_catalog
+   return res
+
 InitializeClass(ContributionTool)
 
 # vim: filetype=python syntax=python shiftwidth=2 




More information about the Erp5-report mailing list