Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9036 closed (fixed)

Discrepancy in admin permissions

Reported by: anonymous Owned by: manuq
Component: contrib.admin Version: 1.0
Severity: Keywords: pycamp2009
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

in django.contrib.admin.sites.AdminSite.index permissions are calculated like so:

                perms = {
                    'add': model_admin.has_add_permission(request),
                    'change': model_admin.has_change_permission(request),
                    'delete': model_admin.has_delete_permission(request),
                }

but then in django.contrib.admin.sites.AdminSite.app_index permissions are done like this:

                    perms = {
                        'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())),
                        'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())),
                        'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())),
                    }

Personally I perfer the way that index does it, but either way, it just needs to be standardized so we don't have different pages giving different results.

Attachments (2)

sites.diff (1001 bytes) - added by leanmeandonothingmachine 8 years ago.
9036-index_perms_discrepancy.diff (954 bytes) - added by manuq 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by anonymous

Changed 8 years ago by leanmeandonothingmachine

Attachment: sites.diff added

comment:2 Changed 8 years ago by leanmeandonothingmachine

Has patch: set

comment:3 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Jacob

The way index does it is correct and should be used in both cases.

comment:5 Changed 8 years ago by manuq

Keywords: pycamp2009 added
Owner: changed from nobody to manuq

Changed 8 years ago by manuq

comment:6 Changed 8 years ago by manuq

The patch attached should do it.

comment:7 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

Fixed in r10451

comment:8 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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