Commit c015c6db authored by Ivan Tyagov's avatar Ivan Tyagov

Avoid to catalog some special roles like Owner (defined in...

Avoid to catalog some special roles like Owner (defined in getSQLCatalog().getSQLCatalogRoleKeysList()).
As __ac_local_roles_group_id_dict__ changed its structure to 'local_group_id': ['Role'] (just the opposite)
adjust test as well.
parent 00c414da
...@@ -150,8 +150,9 @@ class IndexableObjectWrapper(object): ...@@ -150,8 +150,9 @@ class IndexableObjectWrapper(object):
# If not, continue to index it in roles_and_users table. # If not, continue to index it in roles_and_users table.
if (user, role) not in optimized_role_set: if (user, role) not in optimized_role_set:
user_role_dict[role] = user # Only add to user_role_dict if not in optimized_role_set (double check) user_role_dict[role] = user # Only add to user_role_dict if not in optimized_role_set (double check)
else: elif not (role in role_dict):
# add here local roles which are not part of optimized ones # add here local roles which are not part of optimized ones
# and at the same time not a special ones like Owner
if (user, role) not in optimized_role_set: if (user, role) not in optimized_role_set:
user_group = '%s:%s' % (prefix, role) user_group = '%s:%s' % (prefix, role)
if prefix not in allowed_role_set: if prefix not in allowed_role_set:
......
...@@ -585,8 +585,8 @@ class TestLocalRoleManagement(ERP5TypeTestCase): ...@@ -585,8 +585,8 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
obj = self._makeOne() obj = self._makeOne()
self.assertEqual(['Assignor'], obj.__ac_local_roles__.get('F1_G1_S1')) self.assertEqual(['Assignor'], obj.__ac_local_roles__.get('F1_G1_S1'))
self.assertTrue('Assignor' in user.getRolesInContext(obj)) self.assertTrue('Assignor' in user.getRolesInContext(obj))
self.assertEqual(('Alternate',), self.assertEqual(('F1_G1_S1',),
obj.__ac_local_roles_group_id_dict__.get('F1_G1_S1')) obj.__ac_local_roles_group_id_dict__.get('Alternate'))
self.abort() self.abort()
......
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