Opened 7 years ago

Closed 6 years ago

#16958 closed Bug (fixed)

change_password admin view ignores ModelAdmin queryset(request) method

Reported by: Marco Paolini Owned by: Wiktor
Component: contrib.auth Version: 1.3
Severity: Normal Keywords: admin, auth
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


change_password view in django.contrib.auth.admin.UserAdmin does not use
self.queryset() to retrieve the user instance to act on.

Let's assume a developer has subclassed UserAdmin overriding its queryset
method to hide certain users from admin web interface,
then he would be surprised to find out that someone with change_user
permission can still change password of these hidden users.

attached patch (applies to trunk) with test.

Attachments (1)

patch_1_admin_password_change_limited.diff (2.5 KB) - added by Marco Paolini 7 years ago.
patch with test

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Marco Paolini

patch with test

comment:1 Changed 7 years ago by Andreas Pelme

Triage Stage: UnreviewedAccepted

I can confirm that this is an issue, that the patch applies cleanly and that all tests run fine and pass!

comment:2 Changed 6 years ago by Wiktor

Owner: changed from nobody to Wiktor
Status: newassigned

comment:3 Changed 6 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:4 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [17474]:

Fixed #16958 -- Correctly use the queryset method in the auth app's UserAdmin class. Thanks, mpaolini.

Note: See TracTickets for help on using tickets.
Back to Top