Commit 2bec02b9 authored by Ivan Tyagov's avatar Ivan Tyagov

The structure of __ac_local_roles_group_id_dict__ this requires adjustments in the

way it's exported / imported and tested.
parent 7033e2bf
...@@ -4576,8 +4576,9 @@ class LocalRolesTemplateItem(BaseTemplateItem): ...@@ -4576,8 +4576,9 @@ class LocalRolesTemplateItem(BaseTemplateItem):
for principal, local_roles_group_id_list in sorted(local_roles_group_id_dict.items()): for principal, local_roles_group_id_list in sorted(local_roles_group_id_dict.items()):
xml_data += "\n <principal id='%s'>" % escape(principal) xml_data += "\n <principal id='%s'>" % escape(principal)
for local_roles_group_id in local_roles_group_id_list: for local_roles_group_id in local_roles_group_id_list:
for item in local_roles_group_id:
xml_data += "\n <local_roles_group_id>%s</local_roles_group_id>" % \ xml_data += "\n <local_roles_group_id>%s</local_roles_group_id>" % \
escape(local_roles_group_id) escape(item)
xml_data += "\n </principal>" xml_data += "\n </principal>"
xml_data += '\n </local_roles_group_id>' xml_data += '\n </local_roles_group_id>'
...@@ -4609,10 +4610,9 @@ class LocalRolesTemplateItem(BaseTemplateItem): ...@@ -4609,10 +4610,9 @@ class LocalRolesTemplateItem(BaseTemplateItem):
# local roles group id # local roles group id
local_roles_group_id_dict = {} local_roles_group_id_dict = {}
for principal in xml.findall('//principal'): for principal in xml.findall('//principal'):
local_roles_group_id_dict[principal.get('id')] = tuple( local_roles_group_id_dict[principal.get('id')] = set([tuple(
[group_id.text for group_id in [group_id.text for group_id in
principal.findall('./local_roles_group_id')]) principal.findall('./local_roles_group_id')])])
self._objects['local_roles/%s' % (file_name[:-4],)] = ( self._objects['local_roles/%s' % (file_name[:-4],)] = (
local_roles_dict, local_roles_group_id_dict) local_roles_dict, local_roles_group_id_dict)
......
...@@ -6553,8 +6553,8 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6553,8 +6553,8 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# simulate role assignment # simulate role assignment
new_object.__ac_local_roles__ = dict(group=['Assignee']) new_object.__ac_local_roles__ = dict(group=['Assignee'])
new_object.__ac_local_roles_group_id_dict__ = dict(group=('Alternate',)) initial___ac_local_roles_group_id_dict__ = dict(Alternate=set([('group', 'Assignee')]))
new_object.__ac_local_roles_group_id_dict__ = initial___ac_local_roles_group_id_dict__
self.tic() self.tic()
object_type.newContent(portal_type='Role Information', object_type.newContent(portal_type='Role Information',
...@@ -6592,7 +6592,7 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6592,7 +6592,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
path = self.portal.geek_module['1'] path = self.portal.geek_module['1']
self.assertEquals([('group', ['Assignee'],)], [item for item in self.assertEquals([('group', ['Assignee'],)], [item for item in
path.__ac_local_roles__.items() if item[1] != ['Owner']]) path.__ac_local_roles__.items() if item[1] != ['Owner']])
self.assertEquals(dict(group=('Alternate',)), self.assertEquals(initial___ac_local_roles_group_id_dict__,
path.__ac_local_roles_group_id_dict__) path.__ac_local_roles_group_id_dict__)
finally: finally:
# restore state # restore state
......
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