Commit 1f7ad4f9 authored by Julien Muchembled's avatar Julien Muchembled

erp5_administration: fix z_refresh_roles_and_users script

parent f8edef9b
......@@ -31,9 +31,9 @@
DELETE FROM roles_and_users\n
<dtml-var sql_delimiter>\n
INSERT INTO roles_and_users (uid, allowedRolesAndUsers) VALUES\n
<dtml-in expr="role" expr="getPortalObject().portal_catalog.getSQLCatalog().getRoleAndSecurityUidList()">\n
(<dtml-sqlvar expr="role_item[0]" type="int">, <dtml-sqlvar expr="role_item[1]" type="string">, <dtml-sqlvar expr="role_item[2]" type="string">)<dtml-if sequence-end><dtml-else>,</dtml-if>\n
\n
<dtml-in prefix="role" expr="getPortalObject().portal_catalog.getSQLCatalog().getRoleAndSecurityUidList()">\n
(<dtml-sqlvar expr="role_item[2]" type="int">, <dtml-sqlvar expr="role_item[1]" type="string">)<dtml-if sequence-end><dtml-else>,\n
</dtml-if>\n
</dtml-in>
]]></string> </value>
......
......@@ -889,14 +889,19 @@ class Catalog(Folder,
def getRoleAndSecurityUidList(self):
"""
Return a list of 2-tuples, suitable for direct use in a zsqlmethod.
Return a list of 3-tuples, suitable for direct use in a zsqlmethod.
Goal: make it possible to regenerate a table containing this data.
"""
result = []
extend = result.extend
for role_list, security_uid in getattr(
aq_base(self), 'security_uid_dict', {}).iteritems():
extend([(role, security_uid) for role in role_list])
if role_list:
if isinstance(role_list[-1], tuple):
local_role_group_id, role_list = role_list
else:
local_role_group_id = ''
result += [(local_role_group_id, role, security_uid)
for role in role_list]
return result
security.declarePrivate('getSubjectSetUid')
......
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