Commit fe7192ec authored by Vincent Pelletier's avatar Vincent Pelletier

Replace new method getSecurityUidList by getSecurityUidListAndRoleColumnDict,...

Replace new method getSecurityUidList by getSecurityUidListAndRoleColumnDict, because roles_column_dict must be handled along with security uids.
Update partially WorkflowTool patch.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15433 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 93abfac6
...@@ -460,9 +460,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -460,9 +460,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
return allowedRolesAndUsers, role_column_dict return allowedRolesAndUsers, role_column_dict
def getSecurityUidList(self, **kw): def getSecurityUidListAndRoleColumnDict(self, **kw):
""" """
Return a list of security Uids. Return a list of security Uids and a dictionnary containing available
role columns.
TODO: Add a cache. TODO: Add a cache.
""" """
allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(**kw) allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(**kw)
...@@ -470,7 +472,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -470,7 +472,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
method = getattr(catalog, catalog.sql_search_security) method = getattr(catalog, catalog.sql_search_security)
allowedRolesAndUsers = ["'%s'" % (role, ) for role in allowedRolesAndUsers] allowedRolesAndUsers = ["'%s'" % (role, ) for role in allowedRolesAndUsers]
security_uid_list = [x.uid for x in method(security_roles_list = allowedRolesAndUsers)] security_uid_list = [x.uid for x in method(security_roles_list = allowedRolesAndUsers)]
return security_uid_list return security_uid_list, role_column_dict
security.declarePublic( 'getSecurityQuery' ) security.declarePublic( 'getSecurityQuery' )
def getSecurityQuery(self, query=None, **kw): def getSecurityQuery(self, query=None, **kw):
......
...@@ -113,7 +113,7 @@ SECURITY_COLUMN_ID = 'security_uid' ...@@ -113,7 +113,7 @@ SECURITY_COLUMN_ID = 'security_uid'
COUNT_COLUMN_TITLE = 'count' COUNT_COLUMN_TITLE = 'count'
INTERNAL_CRITERION_KEY_LIST = (WORKLIST_METADATA_KEY, SECURITY_PARAMETER_ID) INTERNAL_CRITERION_KEY_LIST = (WORKLIST_METADATA_KEY, SECURITY_PARAMETER_ID)
def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurityUidList): def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurityUidListAndRoleColumnDict):
""" """
Get a list of dict of WorklistVariableMatchDict grouped by compatible conditions. Get a list of dict of WorklistVariableMatchDict grouped by compatible conditions.
Strip any variable which is not a catalog column. Strip any variable which is not a catalog column.
...@@ -158,8 +158,10 @@ def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurity ...@@ -158,8 +158,10 @@ def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurity
if security_cache_key in security_cache: if security_cache_key in security_cache:
criterion_value = security_cache[security_cache_key] criterion_value = security_cache[security_cache_key]
else: else:
security_query = getSecurityUidList(**{criterion_id: criterion_value}) security_uid_list, role_column_dict = getSecurityUidListAndRoleColumnDict(**{criterion_id: criterion_value})
criterion_value = security_query # XXX: role_column_dict is ignored for now. This must be
# implemented.
criterion_value = security_uid_list
security_cache[security_cache_key] = criterion_value security_cache[security_cache_key] = criterion_value
criterion_id = SECURITY_COLUMN_ID criterion_id = SECURITY_COLUMN_ID
else: else:
......
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