From f931cfa18fd2fcfe93cd28db902fb7c8fcd82dbb Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Wed, 22 Aug 2018 11:03:48 +0100 Subject: [PATCH] Exclude apply site from pages if not a super user --- opentech/apply/home/wagtail_hooks.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 opentech/apply/home/wagtail_hooks.py diff --git a/opentech/apply/home/wagtail_hooks.py b/opentech/apply/home/wagtail_hooks.py new file mode 100644 index 000000000..9de9cfd7c --- /dev/null +++ b/opentech/apply/home/wagtail_hooks.py @@ -0,0 +1,12 @@ +from wagtail.core import hooks + +from .models import ApplyHomePage + + +@hooks.register('construct_explorer_page_queryset') +def exclude_fund_pages(parent_page, pages, request): + # Don't allow editors to access the Apply pages in the explorer unless they know whats up + if not request.user.is_superuser: + pages = pages.not_ancestor_of(ApplyHomePage.objects.first(), inclusive=True) + + return pages -- GitLab