Skip to content

Commit 7db1265

Browse files
committed
Add 'is_restore_ok' method
1 parent 01e2872 commit 7db1265

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Features:
3434
(cannot be updated) but can be used in filter -- and thus in normal
3535
index templates as well as in the REST and XMLRPC APIs. (Ralf
3636
Schlatterbeck)
37+
- Add a 'is_restore_ok' method similar to 'is_retire_ok' for use in
38+
templates.
3739

3840
2020-04-05 2.0.0 beta 0
3941

roundup/cgi/templating.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,13 @@ def is_retire_ok(self):
622622
return perm('Web Access', self._client.userid) and perm('Retire',
623623
self._client.userid, self._classname)
624624

625+
def is_restore_ok(self):
626+
""" Is the user allowed to restore retired items of the current class?
627+
"""
628+
perm = self._db.security.hasPermission
629+
return perm('Web Access', self._client.userid) and perm('Restore',
630+
self._client.userid, self._classname)
631+
625632
def is_view_ok(self):
626633
""" Is the user allowed to View the current class?
627634
"""
@@ -935,6 +942,13 @@ def is_retire_ok(self):
935942
return perm('Web Access', self._client.userid) and perm('Retire',
936943
self._client.userid, self._classname, itemid=self._nodeid)
937944

945+
def is_restore_ok(self):
946+
""" Is the user allowed to restore this item?
947+
"""
948+
perm = self._db.security.hasPermission
949+
return perm('Web Access', self._client.userid) and perm('Restore',
950+
self._client.userid, self._classname, itemid=self._nodeid)
951+
938952
def is_view_ok(self):
939953
""" Is the user allowed to View this item?
940954
"""

0 commit comments

Comments
 (0)