diff --git a/changes/123.bugfix b/changes/123.bugfix new file mode 100644 index 0000000..97f6a06 --- /dev/null +++ b/changes/123.bugfix @@ -0,0 +1 @@ +Do not double-check permissions diff --git a/djangocms_page_sitemap/cms_toolbars.py b/djangocms_page_sitemap/cms_toolbars.py index 01c8a13..21e3947 100644 --- a/djangocms_page_sitemap/cms_toolbars.py +++ b/djangocms_page_sitemap/cms_toolbars.py @@ -3,8 +3,6 @@ from cms.toolbar.items import Break from cms.toolbar_base import CMSToolbar from cms.toolbar_pool import toolbar_pool -from cms.utils.conf import get_cms_setting -from cms.utils.permissions import has_page_permission from django.urls import NoReverseMatch, reverse from django.utils.translation import gettext_lazy as _ @@ -24,16 +22,9 @@ def populate(self): # we don't need this on page types return - # check global permissions if CMS_PERMISSIONS is active - if get_cms_setting("PERMISSION"): - has_global_current_page_change_permission = has_page_permission( - self.request.user, self.request.current_page, "change" - ) - else: - has_global_current_page_change_permission = False - # check if user has page edit permission + # check if user has page change permission (respects CMS_PERMISSION) can_change = self.request.current_page and self.request.current_page.has_change_permission(self.request.user) - if has_global_current_page_change_permission or can_change: + if can_change: not_edit_mode = not self.toolbar.edit_mode_active current_page_menu = self.toolbar.get_or_create_menu("page") position = current_page_menu.find_first(Break, identifier=PAGE_MENU_THIRD_BREAK) - 1