Skip to content

Commit

Permalink
Merge branch 'master' into kiram15/ENT-9670
Browse files Browse the repository at this point in the history
  • Loading branch information
kiram15 committed Nov 4, 2024
2 parents 6d5e8b9 + 0ef3314 commit 79d67ad
Show file tree
Hide file tree
Showing 15 changed files with 364 additions and 312 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ Unreleased
----------
* nothing unreleased

[4.30.2]
[4.31.2]
--------
* feat: Creating enterprise customer members endpoint for admin portal

[4.31.1]
--------
* fix: fixed query for monthly_impact_report command.

[4.31.0]
--------
* feat: add new endpoint to unlink the logged in user.

[4.30.1]
--------
* fix: serialize best_mode_for_course_run field in DefaultEnterpriseEnrollmentIntentionSerializer.
Expand Down
3 changes: 2 additions & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Your project description goes here.
"""

__version__ = "4.30.2"
__version__ = "4.31.2"

26 changes: 25 additions & 1 deletion enterprise/api/v1/views/enterprise_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
HTTP_202_ACCEPTED,
HTTP_400_BAD_REQUEST,
HTTP_409_CONFLICT,
HTTP_422_UNPROCESSABLE_ENTITY,
)

from django.contrib import auth
Expand Down Expand Up @@ -460,7 +461,6 @@ def unlink_users(self, request, pk=None): # pylint: disable=unused-argument
"""
Unlinks users with the given emails from the enterprise.
"""

serializer = serializers.EnterpriseCustomerUnlinkUsersSerializer(
data=request.data
)
Expand All @@ -487,3 +487,27 @@ def unlink_users(self, request, pk=None): # pylint: disable=unused-argument
raise UnlinkUserFromEnterpriseError(msg) from exc

return Response(status=HTTP_200_OK)

@action(methods=['post'], detail=True, permission_classes=[permissions.IsAuthenticated])
def unlink_self(self, request, pk=None): # pylint: disable=unused-argument
"""
Unlink request user from the enterprise.
"""
user_email = request.user.email
enterprise_customer = self.get_object()

try:
models.EnterpriseCustomerUser.objects.unlink_user(
enterprise_customer=enterprise_customer, user_email=user_email, is_relinkable=True
)
except (models.EnterpriseCustomerUser.DoesNotExist, models.PendingEnterpriseCustomerUser.DoesNotExist):
msg = "[UNLINK_SELF] User with email {} does not exist in enterprise {}.".format(
user_email, enterprise_customer
)
LOGGER.warning(msg)
return Response(status=HTTP_422_UNPROCESSABLE_ENTITY)
except Exception as exc:
msg = "[UNLINK_SELF] Could not unlink {} from {}".format(user_email, enterprise_customer)
raise UnlinkUserFromEnterpriseError(msg) from exc

return Response(status=HTTP_200_OK)
8 changes: 4 additions & 4 deletions enterprise/management/commands/monthly_impact_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,17 +865,17 @@
FROM (
SELECT
acc.integration_enterprise_uuid__c as uuid,
MAX(opp.contract_end_date__c) latest_contract_end_date
acc.integration_enterprise_uuid_c as uuid,
MAX(opp.contract_end_date_c) latest_contract_end_date
FROM
salesforce_prod_pii.opportunity as opp
LEFT JOIN
salesforce_prod_pii._account as acc
ON
opp.accountid = acc.id
opp.account_id = acc.id
WHERE
-- only closed won contracts
opp.stagename = 'Closed Won'
opp.stage_name = 'Closed Won'
GROUP BY
1
HAVING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ def _transform_item(self, content_metadata_item, action):
getattr(self, f'transform_for_action_{edx_data_schema_key}', None)
)

# pylint: disable=not-callable
if transformer:
transformed_value = transformer(content_metadata_item)
elif transformer_for_action:
Expand Down
2 changes: 1 addition & 1 deletion requirements/celery53.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ click==8.1.7
click-didyoumean==0.3.1
click-repl==0.3.0
kombu==5.4.2
prompt-toolkit==3.0.47
prompt-toolkit==3.0.48
vine==5.1.0
4 changes: 2 additions & 2 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# make upgrade
#
distlib==0.3.8
distlib==0.3.9
# via virtualenv
filelock==3.16.1
# via
Expand All @@ -24,5 +24,5 @@ tox==3.28.0
# via
# -c requirements/constraints.txt
# -r requirements/ci.in
virtualenv==20.26.5
virtualenv==20.27.1
# via tox
4 changes: 4 additions & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ elasticsearch<7.14.0
# This can be unpinned once https://github.com/openedx/edx-platform/issues/34586
# has been resolved and edx-platform is running with pymongo>=4.4.0
event-tracking<2.4.1

# Cause: https://github.com/openedx/edx-lint/issues/458
# This can be unpinned once https://github.com/openedx/edx-lint/issues/459 has been resolved.
pip<24.3
Loading

0 comments on commit 79d67ad

Please sign in to comment.