Commit 821c0971 authored by Jérome Perrin's avatar Jérome Perrin

protect methods with Permissions.AccessContentsInformation

Fix some buggy imports


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5569 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9aebfff
...@@ -30,7 +30,7 @@ from AccessControl import ClassSecurityInfo ...@@ -30,7 +30,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.CMFDefault.utils import formatRFC822Headers
import re import re
class Coordinate(Base): class Coordinate(Base):
...@@ -89,14 +89,16 @@ class Coordinate(Base): ...@@ -89,14 +89,16 @@ class Coordinate(Base):
) )
### helper methods ### helper methods
security.declareProtected( Permissions.View, 'getRegularExpressionFindAll') security.declareProtected( Permissions.AccessContentsInformation,
'getRegularExpressionFindAll')
def getRegularExpressionFindAll(self, regular_expression, string): def getRegularExpressionFindAll(self, regular_expression, string):
""" """
allows call of re.findall in a python script used for Coordinate allows call of re.findall in a python script used for Coordinate
""" """
return re.findall(regular_expression, string) return re.findall(regular_expression, string)
security.declareProtected( Permissions.View, 'getRegularExpressionGroups') security.declareProtected( Permissions.AccessContentsInformation,
'getRegularExpressionGroups')
def getRegularExpressionGroups(self, regular_expression, string): def getRegularExpressionGroups(self, regular_expression, string):
""" """
allows call of re.search.groups in a python script used for Coordinate allows call of re.search.groups in a python script used for Coordinate
...@@ -114,7 +116,8 @@ class Coordinate(Base): ...@@ -114,7 +116,8 @@ class Coordinate(Base):
""" """
return self() return self()
security.declareProtected( Permissions.View, 'SearchableText' ) security.declareProtected( Permissions.AccessContentsInformation,
'SearchableText' )
def getSearchableText(self): def getSearchableText(self):
""" """
text for indexing text for indexing
...@@ -122,7 +125,8 @@ class Coordinate(Base): ...@@ -122,7 +125,8 @@ class Coordinate(Base):
return "%s %s %s" % (self.title, self.description, self.asText()) return "%s %s %s" % (self.title, self.description, self.asText())
SearchableText = getSearchableText SearchableText = getSearchableText
security.declareProtected( Permissions.View, 'asText' ) security.declareProtected( Permissions.AccessContentsInformation,
'asText' )
def asText(self): def asText(self):
""" """
returns the coordinate as a text string returns the coordinate as a text string
...@@ -131,7 +135,8 @@ class Coordinate(Base): ...@@ -131,7 +135,8 @@ class Coordinate(Base):
if script is not None: if script is not None:
return script() return script()
security.declareProtected(Permissions.View, 'getText') security.declareProtected( Permissions.AccessContentsInformation,
'getText')
getText = asText getText = asText
security.declareProtected( Permissions.ModifyPortalContent, 'fromText' ) security.declareProtected( Permissions.ModifyPortalContent, 'fromText' )
...@@ -147,7 +152,8 @@ class Coordinate(Base): ...@@ -147,7 +152,8 @@ class Coordinate(Base):
security.declareProtected(Permissions.ModifyPortalContent, '_setText') security.declareProtected(Permissions.ModifyPortalContent, '_setText')
_setText = fromText _setText = fromText
security.declareProtected(Permissions.View, 'standardTextFormat') security.declareProtected( Permissions.AccessContentsInformation,
'standardTextFormat')
def standardTextFormat(self): def standardTextFormat(self):
""" """
Returns the standard text formats for telephone numbers Returns the standard text formats for telephone numbers
...@@ -158,7 +164,7 @@ class Coordinate(Base): ...@@ -158,7 +164,7 @@ class Coordinate(Base):
def _writeFromPUT( self, body ): def _writeFromPUT( self, body ):
headers = {} headers = {}
headers, body = parseHeadersBody(body, headers) headers, body = parseHeadersBody(body, headers)
lines = string.split( body, '\n' ) lines = body.split( '\n' )
self.edit( lines[0] ) self.edit( lines[0] )
headers['Format'] = self.COORDINATE_FORMAT headers['Format'] = self.COORDINATE_FORMAT
new_subject = keywordsplitter(headers) new_subject = keywordsplitter(headers)
...@@ -203,8 +209,6 @@ class Coordinate(Base): ...@@ -203,8 +209,6 @@ class Coordinate(Base):
""" """
Get the coordinate as text for WebDAV src / FTP download. Get the coordinate as text for WebDAV src / FTP download.
""" """
join = string.join
lower = string.lower
hdrlist = self.getMetadataHeaders() hdrlist = self.getMetadataHeaders()
hdrtext = formatRFC822Headers( hdrlist ) hdrtext = formatRFC822Headers( hdrlist )
bodytext = '%s\n\n%s' % ( hdrtext, self.asText() ) bodytext = '%s\n\n%s' % ( hdrtext, self.asText() )
......
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