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

Edit bird now checks if the user has permission to access admin and edit the page before displaying edit page option

This commit is contained in:
Karl Hobley 2014-03-12 16:53:43 +00:00
parent 91faf4fd5f
commit 4e67491bda

View File

@ -21,6 +21,15 @@ class EditPageItem(BaseItem):
if not self.page.id:
return
# Don't render if user doesn't have permission to access the admin area
if not request.user.has_perm('wagtailadmin.access_admin'):
return
# Don't render if the user doesn't have permission to edit this page
permission_checker = self.page.permissions_for_user(request.user)
if not permission_checker.can_edit():
return
return super(EditPageItem, self).render(request)