Commit 93b820e0 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

*: add some missing security declaration on component code

This does not seem to be an actual problem because the object is
declared protected, but these missing security declarations make
testSecurity fail.
parent d28c0fbc
...@@ -45,7 +45,7 @@ class InternetMessagePost(Item, MailMessageMixin): ...@@ -45,7 +45,7 @@ class InternetMessagePost(Item, MailMessageMixin):
def _getMessage(self): def _getMessage(self):
return email.message_from_string(self.getData()) return email.message_from_string(self.getData())
security.declareProtected(Permissions.AccessContentsInformation, 'stripMessageId')
def stripMessageId(self, message_id): def stripMessageId(self, message_id):
""" """
In rfc5322 headers, message-ids may follow the syntax "<msg-id>" in In rfc5322 headers, message-ids may follow the syntax "<msg-id>" in
...@@ -59,11 +59,10 @@ class InternetMessagePost(Item, MailMessageMixin): ...@@ -59,11 +59,10 @@ class InternetMessagePost(Item, MailMessageMixin):
message_id = message_id[:-1] message_id = message_id[:-1]
return message_id return message_id
security.declareProtected(Permissions.AccessContentsInformation, 'getReference')
def getReference(self): def getReference(self):
return self.stripMessageId(self.getSourceReference()) return self.stripMessageId(self.getSourceReference())
def _setReference(self, value): def _setReference(self, value):
""" """
Raise if given value is different from current value, Raise if given value is different from current value,
......
...@@ -62,6 +62,7 @@ class OpenOrderLine(SupplyLine): ...@@ -62,6 +62,7 @@ class OpenOrderLine(SupplyLine):
, PropertySheet.Comment , PropertySheet.Comment
) )
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalQuantity')
def getTotalQuantity(self, default=0): def getTotalQuantity(self, default=0):
"""Returns the total quantity for this open order line. """Returns the total quantity for this open order line.
If the order line contains cells, the total quantity of cells are If the order line contains cells, the total quantity of cells are
...@@ -72,6 +73,7 @@ class OpenOrderLine(SupplyLine): ...@@ -72,6 +73,7 @@ class OpenOrderLine(SupplyLine):
self.getCellValueList(base_id='path')]) self.getCellValueList(base_id='path')])
return self.getQuantity(default) return self.getQuantity(default)
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice')
def getTotalPrice(self): def getTotalPrice(self):
"""Returns the total price for this open order line. """Returns the total price for this open order line.
If the order line contains cells, the total price of cells are If the order line contains cells, the total price of cells are
......
...@@ -66,6 +66,7 @@ class FTPConnector(XMLObject): ...@@ -66,6 +66,7 @@ class FTPConnector(XMLObject):
# XXX Must manage in the future ftp and ftps protocol # XXX Must manage in the future ftp and ftps protocol
raise NotImplementedError("Protocol %s is not yet implemented" %(self.getUrlProtocol(),)) raise NotImplementedError("Protocol %s is not yet implemented" %(self.getUrlProtocol(),))
security.declareProtected(Permissions.AccessContentsInformation, 'renameFile')
def renameFile(self, old_path, new_path): def renameFile(self, old_path, new_path):
""" Move a file """ """ Move a file """
conn = self.getConnection() conn = self.getConnection()
...@@ -74,6 +75,7 @@ class FTPConnector(XMLObject): ...@@ -74,6 +75,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'removeFile')
def removeFile(self, filepath): def removeFile(self, filepath):
"""Delete the file""" """Delete the file"""
conn = self.getConnection() conn = self.getConnection()
...@@ -82,6 +84,7 @@ class FTPConnector(XMLObject): ...@@ -82,6 +84,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'listFiles')
def listFiles(self, path=".", sort_on=None): def listFiles(self, path=".", sort_on=None):
""" List file of a directory """ """ List file of a directory """
conn = self.getConnection() conn = self.getConnection()
...@@ -90,6 +93,7 @@ class FTPConnector(XMLObject): ...@@ -90,6 +93,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'getFile')
def getFile(self, filepath, binary=True): def getFile(self, filepath, binary=True):
""" Try to get a file on the remote server """ """ Try to get a file on the remote server """
conn = self.getConnection() conn = self.getConnection()
...@@ -101,6 +105,7 @@ class FTPConnector(XMLObject): ...@@ -101,6 +105,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'putFile')
def putFile(self, filename, data, remotepath='.', confirm=True): def putFile(self, filename, data, remotepath='.', confirm=True):
""" Send file to the remote server """ """ Send file to the remote server """
conn = self.getConnection() conn = self.getConnection()
...@@ -125,6 +130,7 @@ class FTPConnector(XMLObject): ...@@ -125,6 +130,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'createDirectory')
def createDirectory(self, path, mode=0o777): def createDirectory(self, path, mode=0o777):
"""Create a directory `path`, with file mode `mode`. """Create a directory `path`, with file mode `mode`.
...@@ -136,6 +142,7 @@ class FTPConnector(XMLObject): ...@@ -136,6 +142,7 @@ class FTPConnector(XMLObject):
finally: finally:
conn.logout() conn.logout()
security.declareProtected(Permissions.AccessContentsInformation, 'removeDirectory')
def removeDirectory(self, path): def removeDirectory(self, path):
"""Create a directory `path`, with file mode `mode`. """Create a directory `path`, with file mode `mode`.
......
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