Commit d3168976 authored by Julien Muchembled's avatar Julien Muchembled

Do not call 'apply' on an existing 'security' attribute once the class is built

More generally, the 'security' attribute should not be used once the class is
built, because the constructor of classes inherited from SimpleItem deletes it.
This is currently tolerated in ERP5 because there is always CopyContainer that
provides one, but it also means that CopyContainer.security is just a mix of
attributes generated automatically on most classes.

Previous code was equivalent to
  CopyContainer.security.declarePrivate('doSomethingStupid')
  CopyContainer.security.apply(Organisation)
which is nonsense.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28730 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e007fc91
......@@ -31,6 +31,7 @@ import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Base import _aq_reset
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import newSecurityManager
import Products.ERP5Type
......@@ -618,8 +619,9 @@ context.setTitle('Bar')
# this method, but does not override existing security definition (defined
# on the class)
Organisation = Products.ERP5Type.Document.Organisation.Organisation
Organisation.security.declarePrivate('doSomethingStupid')
Organisation.security.apply(Organisation)
security = ClassSecurityInfo()
security.declarePrivate('doSomethingStupid')
security.apply(Organisation)
self.createInteractionWorkflow()
self.interaction.setProperties(
......
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