From 1b35fcada55c06933d048da0e6f3ee1c20a9a0da Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Thu, 3 Nov 2005 13:12:02 +0000 Subject: [PATCH] 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 --- product/ERP5Type/ERP5Type.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 1cdd899508..de58050870 100755 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -227,7 +227,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): 'Please install it to benefit from group-based security' # 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 = {} for role, definition_list in role_mapping.items(): if not role_category_list.has_key(role): @@ -317,19 +317,19 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): Return a mapping containing of all roles applicable to the object against user. """ - portal = aq_parent(aq_inner(self)) - if object is None or not hasattr(object, 'aq_base'): - folder = portal + portal = self.portal_url.getPortalObject() + if object is None: + folder = portal else: - folder = object - # Search up the containment hierarchy until we find an - # object that claims it's a folder. - while folder is not None: - if getattr(aq_base(folder), 'isPrincipiaFolderish', 0): - # found it. - break - else: - folder = aq_parent(aq_inner(folder)) + folder = aq_parent(object) + # Search up the containment hierarchy until we find an + # object that claims it's a folder. + while folder is not None: + if getattr(aq_base(folder), 'isPrincipiaFolderish', 0): + # found it. + break + else: + folder = aq_parent(folder) ec = createExprContext(folder, portal, object) roles = [] -- 2.30.9