Opened 13 years ago

Closed 13 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

Description

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 13 years ago.
patch with test

Download all attachments as: .zip

Change History (5)

by Marco Paolini, 13 years ago

patch with test

comment:1 by Andreas Pelme, 13 years ago

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 by Wiktor, 13 years ago

Owner: changed from nobody to Wiktor
Status: newassigned

comment:3 by Jannis Leidel, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Jannis Leidel, 13 years ago

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