diff --git a/common/djangoapps/third_party_auth/samlproviderconfig/views.py b/common/djangoapps/third_party_auth/samlproviderconfig/views.py index a8cdb40d7d..ac4832f4ef 100644 --- a/common/djangoapps/third_party_auth/samlproviderconfig/views.py +++ b/common/djangoapps/third_party_auth/samlproviderconfig/views.py @@ -2,7 +2,7 @@ Viewset for auth/saml/v0/samlproviderconfig """ -from django.shortcuts import get_object_or_404 +from django.shortcuts import get_list_or_404 from edx_rbac.mixins import PermissionRequiredMixin from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from rest_framework import permissions, viewsets, status @@ -54,12 +54,12 @@ class SAMLProviderConfigViewSet(PermissionRequiredMixin, SAMLProviderMixin, view """ if self.requested_enterprise_uuid is None: raise ParseError('Required enterprise_customer_uuid is missing') - enterprise_customer_idp = get_object_or_404( + enterprise_customer_idps = get_list_or_404( EnterpriseCustomerIdentityProvider, enterprise_customer__uuid=self.requested_enterprise_uuid ) - return SAMLProviderConfig.objects.current_set().filter( - slug=convert_saml_slug_provider_id(enterprise_customer_idp.provider_id)) + slug_list = [idp.provider_id for idp in enterprise_customer_idps] + return [config for config in SAMLProviderConfig.objects.current_set() if config.provider_id in slug_list] @property def requested_enterprise_uuid(self):