Commit 0f40836d authored by Romain Courteaud's avatar Romain Courteaud

In getCategoryRelatedValueList, replace query parameter to checked_permission parameter.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13558 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5e4b22a
......@@ -1269,7 +1269,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
'getRelatedValueList' )
def getRelatedValueList(self, context, base_category_list=None,
spec=(), filter=None, base=1,
query=None, **kw):
checked_permission=None, **kw):
"""
This methods returns the list of objects related to the context
with the given base_category_list.
......@@ -1295,6 +1295,14 @@ class CategoryTool( UniqueObject, Folder, Base ):
for base_category in base_category_list:
category_list.append("%s/%s" % (base_category, context.getRelativeUrl()))
# XXX TODO Only 'View' permission filtering is implemented now
query = None
if checked_permission is not None:
if isinstance(checked_permission, str):
checked_permission = (checked_permission, )
if 'View' in checked_permission:
# Use catalog for checking the View permission
query = self.portal_catalog.getSecurityQuery()
if query is not None:
query = self.portal_catalog.buildSQLQuery(query=query)
# XXX Is Base_zSearchRelatedObjectsByCategoryList still usefull ?
......@@ -1320,14 +1328,16 @@ class CategoryTool( UniqueObject, Folder, Base ):
return result
# XXX missing filter and **kw stuff
#return self.search_category(category_list = category_list, portal_type = spec)
#return self.search_category(category_list=category_list,
# portal_type=spec)
# future implementation with brains, much more efficient
security.declareProtected( Permissions.AccessContentsInformation,
'getRelatedPropertyList' )
def getRelatedPropertyList(self, context, base_category_list=None,
property_name=None, spec=(),
filter=None, base=1, query=None, **kw):
filter=None, base=1,
checked_permission=None, **kw):
"""
This methods returns the list of property_name on objects
related to the context with the given base_category_list.
......@@ -1336,7 +1346,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
for o in self.getRelatedValueList(
context=context,
base_category_list=base_category_list, spec=spec,
filter=filter, base=base, query=query, **kw):
filter=filter, base=base,
checked_permission=checked_permission, **kw):
result.append(o.getProperty(property_name, None))
return result
......
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