Skip to content

Commit 8f634fd

Browse files
authored
Merge pull request #172 from eduNEXT/mjh/add-flag-save-parameters-audit
feat: add save_all_parameters and filter_data to eox-audit-model decorators
2 parents d167364 + 33541b4 commit 8f634fd

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@ Change Log
1111
.. There should always be an "Unreleased" section for changes pending release.
1212
Unreleased
1313
----------
14+
15+
[4.16.0] - 2021-08-18
16+
---------------------
17+
18+
Added
19+
~~~~~~~
1420
* Add new middleware to catch unhandled exceptions during the third
1521
party authentication.
22+
* Add save_all_parameters argument to the eox-audit-model decorator for the Users API.
23+
* Add filter_data list to the eox-audit-model decorator for the Enrollments API.
1624

1725
[4.15.1] - 2021-08-13
1826
---------------------

eox_core/api/v1/views.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ class EdxappUser(UserQueryMixin, APIView):
182182
"fullname",
183183
],
184184
hidden_fields=["password"],
185+
save_all_parameters=True,
185186
method_name='eox_core_api_method',
186187
)
187188
def post(self, request, *args, **kwargs):
@@ -414,6 +415,7 @@ class EdxappUserUpdater(UserQueryMixin, APIView):
414415
'is_active',
415416
],
416417
hidden_fields=['password'],
418+
save_all_parameters=True,
417419
method_name='eox_core_api_method',
418420
)
419421
def patch(self, request, *args, **kwargs):
@@ -541,7 +543,18 @@ class EdxappEnrollment(UserQueryMixin, APIView):
541543
400: "Bad request, invalid course_id or missing either email or username.",
542544
},
543545
)
544-
@audit_drf_api(action='Create single or bulk enrollments', method_name='eox_core_api_method')
546+
@audit_drf_api(
547+
action='Create single or bulk enrollments',
548+
data_filter=[
549+
'email',
550+
'username',
551+
'course_id',
552+
'mode',
553+
'is_active',
554+
'enrollment_attributes',
555+
],
556+
method_name='eox_core_api_method',
557+
)
545558
def post(self, request, *args, **kwargs):
546559
"""
547560
Handle creation of single or bulk enrollments
@@ -641,7 +654,18 @@ def post(self, request, *args, **kwargs):
641654
400: "Bad request, invalid course_id or missing either email or username.",
642655
},
643656
)
644-
@audit_drf_api(action='Update enrollments on edxapp', method_name='eox_core_api_method')
657+
@audit_drf_api(
658+
action='Update enrollments on edxapp',
659+
data_filter=[
660+
'email',
661+
'username',
662+
'course_id',
663+
'mode',
664+
'is_active',
665+
'enrollment_attributes',
666+
],
667+
method_name='eox_core_api_method',
668+
)
645669
def put(self, request, *args, **kwargs):
646670
"""
647671
Update enrollments on edxapp

0 commit comments

Comments
 (0)