0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

add can_unschedule to PagePermissionTester

This commit is contained in:
Abdulmalik Abdulwahab 2018-07-06 00:18:01 +01:00 committed by Matt Westcott
parent 254092e595
commit 3e1511d362
2 changed files with 4 additions and 1 deletions

View File

@ -1154,7 +1154,7 @@ def revisions_unschedule(request, page_id, revision_id):
page = get_object_or_404(Page, id=page_id).specific
user_perms = UserPagePermissionsProxy(request.user)
if not user_perms.for_page(page).can_publish():
if not user_perms.for_page(page).can_unschedule():
raise PermissionDenied
revision = get_object_or_404(page.revisions, id=revision_id)

View File

@ -1759,6 +1759,9 @@ class PagePermissionTester:
def can_set_view_restrictions(self):
return self.can_publish()
def can_unschedule(self):
return self.can_publish()
def can_lock(self):
return self.user.is_superuser or ('lock' in self.permissions)