From 3e1511d3621946b7544576c9dc9f40823d4f4c4b Mon Sep 17 00:00:00 2001 From: Abdulmalik Abdulwahab Date: Fri, 6 Jul 2018 00:18:01 +0100 Subject: [PATCH] add can_unschedule to PagePermissionTester --- wagtail/admin/views/pages.py | 2 +- wagtail/core/models.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wagtail/admin/views/pages.py b/wagtail/admin/views/pages.py index 4f9f1e9173..c8e6958b62 100644 --- a/wagtail/admin/views/pages.py +++ b/wagtail/admin/views/pages.py @@ -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) diff --git a/wagtail/core/models.py b/wagtail/core/models.py index bba1473ed7..52bbeffc9e 100644 --- a/wagtail/core/models.py +++ b/wagtail/core/models.py @@ -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)