Skip to content

Commit

Permalink
Merge pull request #59 from telefonicaid/task/support_groups_in_service
Browse files Browse the repository at this point in the history
check only role assignments to users not groups
  • Loading branch information
XavierVal authored Dec 20, 2016
2 parents e89023e + 292cf34 commit f4faae0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/orchestrator/core/flow/Roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,16 @@ def roles_assignments(self,

role_assignments_expanded = []
for role_assignment in ROLE_ASSIGNMENTS['role_assignments']:
if 'group' in role_assignment:
continue
if ROLE_ID:
if not (role_assignment['role']['id'] == ROLE_ID):
continue
if PROJECT_ID:
if not (role_assignment['scope']['project']['id'] == PROJECT_ID):
continue
if USER_ID:
if not (role_assignment['user']['id'] == USER_ID):
if ('user' in role_assignment) and not (role_assignment['user']['id'] == USER_ID):
continue
role_assignments_expanded.append(role_assignment)

Expand All @@ -255,12 +257,12 @@ def roles_assignments(self,
ADMIN_TOKEN,
DOMAIN_ID,
USER_ID)

for assign in role_assignments_expanded:
# Expand user detail
match_list = [x for x in domain_users['users'] if x['id'] == str(assign['user']['id'])]
if len(match_list) > 0:
assign['user'].update(match_list[0])
if 'user' in assign:
match_list = [x for x in domain_users['users'] if x['id'] == str(assign['user']['id'])]
if len(match_list) > 0:
assign['user'].update(match_list[0])
# Expand role detail
match_list = [x for x in domain_roles['roles'] if str(x['id']) == str(assign['role']['id'])]
if len(match_list) > 0:
Expand Down

0 comments on commit f4faae0

Please sign in to comment.