#11513 closed (fixed)
Admin Change Page Redirects to Permission Denied
Reported by: | Richard Laager | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | Keywords: | ||
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
If ModelAdmin is subclassed to override has_change_permission() to provide row-level change permissions, it's possible to edit an object, click save, and be redirected to the list of all such objects and get a Permission Denied error page. The attached patch checks for the appropriate permissions and does the right thing. This sort of check exists elsewhere in the file, just not here.
Attachments (2)
Change History (10)
by , 15 years ago
Attachment: | admin-change-redirect-permissions-check.diff added |
---|
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 15 years ago
Component: | Uncategorized → django.contrib.admin |
---|---|
Needs tests: | set |
Version: | 1.0 |
by , 14 years ago
Attachment: | 11513_adming_change_view_redirect.diff added |
---|
comment:3 by , 14 years ago
milestone: | → 1.3 |
---|---|
Needs tests: | unset |
comment:4 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Looks good; my only suggested improvement would be to use named URL lookup instead of ../ and ../../../. However, that's easy enough to pick up on commit, so if you don't get around to updating the patch, I'll do it when I commit.
comment:5 by , 14 years ago
Good point about the hard coded urls. There are still lots of occurrences like this, and perhaps it's best to tackle them all at once. See #15294.
Thanks for the report rlaager. The behaviour should actually be slightly different from that in your patch. Like the 'add' view, it should redirect to the admin's root page if there are no appropriate 'change' permissions. The new patch fixes that and also contains thorougher tests for row level 'change' permissions.