Commit d77c7978 authored by Ivan Tyagov's avatar Ivan Tyagov

Add local roles which were not added into previous commits.

parent 633e4ade
...@@ -140,7 +140,7 @@ class IndexableObjectWrapper(object): ...@@ -140,7 +140,7 @@ class IndexableObjectWrapper(object):
prefix = 'user:' + user prefix = 'user:' + user
group_allowed_set.update((prefix, '%s:%s' % (prefix, role))) group_allowed_set.update((prefix, '%s:%s' % (prefix, role)))
optimized_role_set.add((user, role)) optimized_role_set.add((user, role))
# Then parse other roles # Then parse other roles
for user, roles in localroles.iteritems(): for user, roles in localroles.iteritems():
prefix = 'user:' + user prefix = 'user:' + user
...@@ -150,9 +150,15 @@ class IndexableObjectWrapper(object): ...@@ -150,9 +150,15 @@ 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)
if role in allowed_role_set: else:
user_view_permission_role_dict[role] = user # add here local roles which are not part of optimized ones
if (user, role) not in optimized_role_set:
user_group = '%s:%s' % (prefix, role)
if prefix not in allowed_role_set:
allowed_role_set.add(prefix)
if user_group not in allowed_role_set:
allowed_role_set.add(user_group)
# sort `allowed` principals # sort `allowed` principals
sorted_allowed_by_local_roles_group_id = {} sorted_allowed_by_local_roles_group_id = {}
for local_roles_group_id, allowed in \ for local_roles_group_id, allowed in \
......
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