Commit f1599ef5 authored by Romain Courteaud's avatar Romain Courteaud

Initialize portal type (and aq_dynamic) on objects before setting the local roles and notifying

the workflows.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19078 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8517282c
...@@ -279,6 +279,11 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -279,6 +279,11 @@ class ERP5TypeInformation( FactoryTypeInformation,
# Then keep on the construction process # Then keep on the construction process
ob = self._constructInstance(container, id, *args, **kw) ob = self._constructInstance(container, id, *args, **kw)
# Portal type has to be set before setting other attributes
# in order to initialize aq_dynamic
if hasattr(ob, '_setPortalTypeName'):
ob._setPortalTypeName(self.getId())
# Only try to assign roles to security groups if some roles are defined # Only try to assign roles to security groups if some roles are defined
# This is an optimisation to prevent defining local roles on subobjects # This is an optimisation to prevent defining local roles on subobjects
# which acquire their security definition from their parent # which acquire their security definition from their parent
...@@ -287,7 +292,13 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -287,7 +292,13 @@ class ERP5TypeInformation( FactoryTypeInformation,
if len(self._roles): if len(self._roles):
self.updateLocalRolesOnSecurityGroups(ob) self.updateLocalRolesOnSecurityGroups(ob)
ob = self._finishConstruction(ob) # notify workflow after generating local roles, in order to prevent
# Unauthorized error on transition's condition
if hasattr(aq_base(ob), 'notifyWorkflowCreated'):
ob.notifyWorkflowCreated()
# Reindex the object at the end
ob.reindexObject()
if self.init_script : if self.init_script :
# Acquire the init script in the context of this object # Acquire the init script in the context of this object
......
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