def _add_roles_to_users(self, request, data, project_id, user_id, role_ids, available_roles):
    member_step = self.get_step(PROJECT_USER_MEMBER_SLUG)
    current_role_ids = list(role_ids)
    for role in available_roles:
        field_name = member_step.get_member_field_name(role.id)
        if (user_id in data[field_name]):
            if (role.id not in current_role_ids):
                api.keystone.add_tenant_user_role(request, project=project_id, user=user_id, role=role.id)
            else:
                index = current_role_ids.index(role.id)
                current_role_ids.pop(index)
    return current_role_ids
def _add_roles_to_users(self, request, data, project_id, user_id, role_ids, available_roles):
    member_step = self.get_step(PROJECT_USER_MEMBER_SLUG)
    current_role_ids = list(role_ids)
    for role in available_roles:
        field_name = member_step.get_member_field_name(role.id)
        if (user_id in data[field_name]):
            if (role.id not in current_role_ids):
                api.keystone.add_tenant_user_role(request, project=project_id, user=user_id, role=role.id)
            else:
                index = current_role_ids.index(role.id)
                current_role_ids.pop(index)
    return current_role_ids