Skip to content

Commit

Permalink
fix: ensure correct admin_users in EnterpriseCustomerUserViewSet resp…
Browse files Browse the repository at this point in the history
…onse
  • Loading branch information
adamstankiewicz committed Nov 14, 2024
1 parent b5f2126 commit 673b816
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
* nothing unreleased

[4.32.2]
--------
* fix: ensure admin_users in EnterpriseCustomerUserViewSet is correct.

[4.32.1]
--------
* feat: enable search filter on learner data transmission audit admin views for all integrated channels.
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.32.1"
__version__ = "4.32.2"
11 changes: 10 additions & 1 deletion enterprise/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class Meta:
)

user = UserSerializer()
enterprise_customer = EnterpriseCustomerSerializer()
enterprise_customer = serializers.SerializerMethodField()
data_sharing_consent_records = serializers.SerializerMethodField()
groups = serializers.SerializerMethodField()
role_assignments = serializers.SerializerMethodField()
Expand Down Expand Up @@ -756,6 +756,15 @@ def __init__(self, instance=None, data=empty, **kwargs):
)
self.role_assignments_by_ecu_id = role_assignments_by_ecu_id

def get_enterprise_customer(self, obj):
"""
Return serialization of the associated EnterpriseCustomer. By using a SerializerMethodField, we can
ensure that the EnterpriseCustomerSerializer is passed the instance of the EnterpriseCustomer model.
"""
if obj.enterprise_customer:
return EnterpriseCustomerSerializer(obj.enterprise_customer).data
return None

def get_data_sharing_consent_records(self, obj):
"""
Return serialization of EnterpriseCustomerUser.data_sharing_consent_records property.
Expand Down

0 comments on commit 673b816

Please sign in to comment.