From d191b52ee92a75852afd8aea0d7af243ce00bea0 Mon Sep 17 00:00:00 2001 From: Mike O'Connell Date: Mon, 29 Jun 2020 12:57:03 -0400 Subject: [PATCH] Check current enterprise for consent When checking if consent is needed, ignore any enterprise learner details that are not for the learner's currently active enterprise. ENT-3049 --- openedx/features/enterprise_support/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openedx/features/enterprise_support/api.py b/openedx/features/enterprise_support/api.py index 33976f4f4e..6c3a501b3b 100644 --- a/openedx/features/enterprise_support/api.py +++ b/openedx/features/enterprise_support/api.py @@ -474,12 +474,14 @@ def consent_needed_for_course(request, user, course_id, enrollment_exists=False) consent_needed = False else: client = ConsentApiClient(user=request.user) + current_enterprise_uuid = enterprise_customer_uuid_for_request(request) consent_needed = any( - Site.objects.get(domain=learner['enterprise_customer']['site']['domain']) == request.site + current_enterprise_uuid == learner['enterprise_customer']['uuid'] + and Site.objects.get(domain=learner['enterprise_customer']['site']['domain']) == request.site and client.consent_required( username=user.username, course_id=course_id, - enterprise_customer_uuid=learner['enterprise_customer']['uuid'], + enterprise_customer_uuid=current_enterprise_uuid, enrollment_exists=enrollment_exists, ) for learner in enterprise_learner_details