Skip to content

Commit 6f9392b

Browse files
committed
Added has_change_permission check to SimpleHistoryAdmin.history_view
1 parent 63e4bd8 commit 6f9392b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Authors
5151
- Kevin Foster
5252
- Shane Engelman
5353
- Ray Logel
54+
- Nathan Villagaray-Carski
5455

5556
Background
5657
==========

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changes
22
=======
33

4+
Unreleased
5+
----------
6+
- Fix bug where history_view ignored user permissions
7+
48
1.9.1 (2018-03-30)
59
------------------
610
- Use get_queryset rather than model.objects in history_view. (gh-303)

simple_history/admin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def history_view(self, request, object_id, extra_context=None):
6363
obj = action_list.latest('history_date').instance
6464
except action_list.model.DoesNotExist:
6565
raise http.Http404
66+
67+
if not self.has_change_permission(request, obj):
68+
raise PermissionDenied
69+
6670
content_type = ContentType.objects.get_by_natural_key(
6771
*USER_NATURAL_KEY)
6872
admin_user_view = 'admin:%s_%s_change' % (content_type.app_label,

0 commit comments

Comments
 (0)