diff roundup/cgi/templating.py @ 4524:68bbefb72825

Allow HTMLRequest.batch to filter on other permissions than "View"... ...(e.g. on the new "Search" permission") by adding a "permission" parameter. Thanks to Eli Collins for the patch. Closes issue2550699.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Fri, 15 Jul 2011 14:13:51 +0000
parents 22bc0426e348
children 61cd652da1cd
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Fri Jul 15 14:05:29 2011 +0000
+++ b/roundup/cgi/templating.py	Fri Jul 15 14:13:51 2011 +0000
@@ -2718,7 +2718,7 @@
 </script>
 """%self.base
 
-    def batch(self):
+    def batch(self, permission='View'):
         """ Return a batch object for results from the "current search"
         """
         check = self._client.db.security.hasPermission
@@ -2744,7 +2744,7 @@
 
         # filter for visibility
         l = [id for id in klass.filter(matches, filterspec, sort, group)
-            if check('View', userid, self.classname, itemid=id)]
+            if check(permission, userid, self.classname, itemid=id)]
 
         # return the batch object, using IDs only
         return Batch(self.client, l, self.pagesize, self.startwith,

Roundup Issue Tracker: http://roundup-tracker.org/