From 0630c65ea8d1e64e1a2eeda881626441c12936a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrey=20Ca=C3=B1on?= <36200299+andrey-canon@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:35:42 -0500 Subject: [PATCH] feat: filter by current site organizations (#45) --- lms/djangoapps/mobile_api/users/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index b5b900b4504c..d5e061884b16 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -36,6 +36,7 @@ from lms.djangoapps.courseware.views.index import save_positions_recursively_up from lms.djangoapps.mobile_api.models import MobileConfig from lms.djangoapps.mobile_api.utils import API_V1, API_V05, API_V2, API_V3, API_V4 +from openedx.core.djangoapps.site_configuration.helpers import get_current_site_orgs from openedx.features.course_duration_limits.access import check_course_expired from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order @@ -346,6 +347,11 @@ def is_org(self, check_org, course_org): """ Check course org matches request org param or no param provided """ + current_orgs = get_current_site_orgs() + + if current_orgs and course_org not in current_orgs: + return False + return check_org is None or (check_org.lower() == course_org.lower()) def get_serializer_context(self):