Commit 4a8dac52 authored by Nicolas Delaby's avatar Nicolas Delaby

Protect getData and getTextContent with same protection

used for conversion. eg. _checkConversionFormatPermission


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35755 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0c1d950c
......@@ -176,6 +176,7 @@ class File(Document, CMFFile):
security.declareProtected(Permissions.AccessContentsInformation, 'getData')
def getData(self, default=None):
"""return Data as str."""
self._checkConversionFormatPermission(None)
data = self._baseGetData()
if data is None:
return None
......
......@@ -356,6 +356,18 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
self._setBaseContentType(content_type)
return message
security.declareProtected(Permissions.AccessContentsInformation,
'getTextContent')
def getTextContent(self, default=_MARKER):
"""Overriden method to check
permission to access content in raw format
"""
self._checkConversionFormatPermission(None)
if default is _MARKER:
return self._baseGetTextContent()
else:
return self._baseGetTextContent(default)
# Backward compatibility for replacement of text_format by content_type
security.declareProtected(Permissions.AccessContentsInformation,
'getTextFormat')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment