# HG changeset patch # User Ralf Schlatterbeck # Date 1588343585 -7200 # Node ID edbd4bba728a9ba3a093149e26b49d521b469382 # Parent 6a2de96066529ea51a0ad5120f81131d4358a793 Add 'is_restore_ok' method diff -r 6a2de9606652 -r edbd4bba728a CHANGES.txt --- 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 diff -r 6a2de9606652 -r edbd4bba728a roundup/cgi/templating.py --- 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? """