def get_project_users_roles(request, project):
    users_roles = collections.defaultdict(list)
    if VERSIONS.active < 3:
        project_users = user_list(request, project=project)

        for user in project_users:
            roles = roles_for_user(request, user.id, project)
            roles_ids = [role.id for role in roles]
            users_roles[user.id].extend(roles_ids)
    else:
        project_role_assignments = role_assignments_list(request,
                                                         project=project)
        for role_assignment in project_role_assignments:
            if not hasattr(role_assignment, 'user'):
                continue
            user_id = role_assignment.user['id']
            role_id = role_assignment.role['id']

            # filter by project_id
            if ('project' in role_assignment.scope and
                    role_assignment.scope['project']['id'] == project):
                    users_roles[user_id].append(role_id)
    return users_roles
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/api/keystone.py/get_project_users_roles/original