Commit 1b35fcad authored by Alexandre Boeglin's avatar Alexandre Boeglin

Modified ExpressionContext used for role definitions.

It was previously using the ERP5 Type Information as the expression 'object'.
This has been changed to use the created/modified object itself, instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4217 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f4096dbd
...@@ -227,7 +227,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -227,7 +227,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
'Please install it to benefit from group-based security' 'Please install it to benefit from group-based security'
# Retrieve applicable roles # Retrieve applicable roles
role_mapping = self.getFilteredRoleListFor(object = self) # kw provided in order to take any appropriate action role_mapping = self.getFilteredRoleListFor(object=object) # kw provided in order to take any appropriate action
role_category_list = {} role_category_list = {}
for role, definition_list in role_mapping.items(): for role, definition_list in role_mapping.items():
if not role_category_list.has_key(role): if not role_category_list.has_key(role):
...@@ -317,11 +317,11 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -317,11 +317,11 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
Return a mapping containing of all roles applicable to the Return a mapping containing of all roles applicable to the
object against user. object against user.
""" """
portal = aq_parent(aq_inner(self)) portal = self.portal_url.getPortalObject()
if object is None or not hasattr(object, 'aq_base'): if object is None:
folder = portal folder = portal
else: else:
folder = object folder = aq_parent(object)
# Search up the containment hierarchy until we find an # Search up the containment hierarchy until we find an
# object that claims it's a folder. # object that claims it's a folder.
while folder is not None: while folder is not None:
...@@ -329,7 +329,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -329,7 +329,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
# found it. # found it.
break break
else: else:
folder = aq_parent(aq_inner(folder)) folder = aq_parent(folder)
ec = createExprContext(folder, portal, object) ec = createExprContext(folder, portal, object)
roles = [] roles = []
......
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