Commit 9c82531e authored by Alexandre Boeglin's avatar Alexandre Boeglin

When using PAS, add the roles in the ZODB Role Manager as well as a property

on the portal object.
Note : removing roles has not been implemented.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4559 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c83131bd
......@@ -1650,13 +1650,23 @@ class RoleTemplateItem(BaseTemplateItem):
def install(self, context, **kw):
p = context.getPortalObject()
roles = {}
for role in p.__ac_roles__:
roles[role] = 1
# get roles
if (getattr(self, 'template_format_version', 0)) == 1:
role_list = self._objects.keys()
else:
role_list = self._archive.keys()
# set roles in PAS
if p.acl_users.meta_type == 'Pluggable Auth Service':
role_manager_list = p.acl_users.objectValues('ZODB Role Manager')
for role_manager in role_manager_list:
existing_role_list = role_manager.listRoleIds()
for role in role_list:
if role not in existing_role_list:
role_manager.addRole(role)
# set roles on portal
roles = {}
for role in p.__ac_roles__:
roles[role] = 1
for role in role_list:
roles[role] = 1
p.__ac_roles__ = tuple(roles.keys())
......
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