Commit 950046bc authored by Jean-Paul Smets's avatar Jean-Paul Smets

Speed optimisation for security


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3710 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 65918758
...@@ -140,13 +140,19 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -140,13 +140,19 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
""" """
ob = FactoryTypeInformation.constructInstance(self, container, id, *args, **kw) ob = FactoryTypeInformation.constructInstance(self, container, id, *args, **kw)
# Try to find the local role init script # Only try to find the local role init script
init_role_script = getattr(ob, ERP5TYPE_ROLE_INIT_SCRIPT, None) # if some roles are defined
if init_role_script is not None: # This is an optimisation to prevent defining local roles on subobjects
# Retrieve applicable roles # which acquire their security definition from their parent
role_mapping = self.getFilteredRoleListFor(object = self) # kw provided in order to take any appropriate action # The downside of this optimisation is that it is not possible to
# Call the local role init script # set a local role definition if the local role list is empty
init_role_script(role_mapping = role_mapping, **kw) if len(self._roles):
init_role_script = getattr(ob, ERP5TYPE_ROLE_INIT_SCRIPT, None)
if init_role_script is not None:
# Retrieve applicable roles
role_mapping = self.getFilteredRoleListFor(object = self) # kw provided in order to take any appropriate action
# Call the local role init script
init_role_script(role_mapping = role_mapping, **kw)
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