diff --git a/openedx/core/djangoapps/appsembler/openedx_api/filters.py b/openedx/core/djangoapps/appsembler/openedx_api/filters.py index 3bb452012b6..8668d52d7f9 100644 --- a/openedx/core/djangoapps/appsembler/openedx_api/filters.py +++ b/openedx/core/djangoapps/appsembler/openedx_api/filters.py @@ -83,7 +83,6 @@ class AllowedCourseOrgFilterSet(filters.FilterSet): def filter_allowed_org(self, queryset, name, value): import pdb; pdb.set_trace() - requesting_user = self.request.user try: user_allowed_org = self.request.user.organizations.first() @@ -132,3 +131,15 @@ def get_filterset_class(self, view, queryset=None): return super(AppsemblerMultiTenantFilterBackend, self).get_filterset_class(view, queryset) else: return AllowedCourseOrgFilterSet + + def get_filterset_kwargs(self, request, queryset, view): + try: + user_allowed_org = self.request.user.organizations.first() + except Organization.DoesNotExist: + raise # TODO: do something else + + return { + "data": request.query_params.update({"allowed_org": user_allowed_org}), + "queryset": queryset, + "request": request, + }