Skip to content

Commit

Permalink
Fixed issue in DXDocumentGenerationHelperView.check_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
duchenean committed Oct 15, 2024
1 parent f7fcebb commit cd1e6ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changelog
[aduchene]
- Fixed an issue when odt_file.filename could be None when searching and replacing.
[aduchene]
- Fixed an issue with `helper.dexterity.DXDocumentGenerationHelperView.check_permission` raising when it should not.
[aduchene]

3.43 (2024-04-10)
-----------------
Expand Down
8 changes: 5 additions & 3 deletions src/collective/documentgenerator/helper/dexterity.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""Helper view for dexterity content types."""

from ..interfaces import IFieldRendererForDocument
from .base import DisplayProxyObject
from .base import DocumentGenerationHelperView
from AccessControl import getSecurityManager
from bs4 import BeautifulSoup as Soup
from collective.excelexport.exportables.dexterityfields import get_ordered_fields
from imio.helpers.content import get_relations as ih_get_relations
Expand Down Expand Up @@ -81,8 +81,10 @@ def check_permission(self, field_name):
if permission is None:
return True

user = api.user.get_current()
return api.user.has_permission(permission, user=user, obj=self.real_context)
# We can't use plone.api.user.has_permission anymore since
# https://github.com/plone/plone.api/pull/526 as we pass a permission id and if
# we don't have the perm, it raises now
return bool(getSecurityManager().checkPermission(permission, self.real_context))

def get_value(self, field_name, obj=None, default=None, as_utf8=False, strict=True):
"""Get value of field_name for obj
Expand Down

0 comments on commit cd1e6ac

Please sign in to comment.