changeset 6150:edbd4bba728a

Add 'is_restore_ok' method
author Ralf Schlatterbeck <rsc@runtux.com>
date Fri, 01 May 2020 16:33:05 +0200
parents 6a2de9606652
children ff059afae50a
files CHANGES.txt roundup/cgi/templating.py
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Thu Apr 30 13:27:04 2020 +0200
+++ b/CHANGES.txt	Fri May 01 16:33:05 2020 +0200
@@ -34,6 +34,8 @@
   (cannot be updated) but can be used in filter -- and thus in normal
   index templates as well as in the REST and XMLRPC APIs. (Ralf
   Schlatterbeck)
+- Add a 'is_restore_ok' method similar to 'is_retire_ok' for use in
+  templates.
 
 2020-04-05 2.0.0 beta 0
 
--- a/roundup/cgi/templating.py	Thu Apr 30 13:27:04 2020 +0200
+++ b/roundup/cgi/templating.py	Fri May 01 16:33:05 2020 +0200
@@ -622,6 +622,13 @@
         return perm('Web Access', self._client.userid) and perm('Retire',
             self._client.userid, self._classname)
 
+    def is_restore_ok(self):
+        """ Is the user allowed to restore retired items of the current class?
+        """
+        perm = self._db.security.hasPermission
+        return perm('Web Access', self._client.userid) and perm('Restore',
+            self._client.userid, self._classname)
+
     def is_view_ok(self):
         """ Is the user allowed to View the current class?
         """
@@ -935,6 +942,13 @@
         return perm('Web Access', self._client.userid) and perm('Retire',
             self._client.userid, self._classname, itemid=self._nodeid)
 
+    def is_restore_ok(self):
+        """ Is the user allowed to restore this item?
+        """
+        perm = self._db.security.hasPermission
+        return perm('Web Access', self._client.userid) and perm('Restore',
+            self._client.userid, self._classname, itemid=self._nodeid)
+
     def is_view_ok(self):
         """ Is the user allowed to View this item?
         """

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