Opened 14 years ago

Last modified 9 years ago

#13664 new New feature

Enable admin permission checks from outside the ModelAdmin

Reported by: Sebastian Noack Owned by: nobody
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At the moment there is no clean and convinient way to check for the admin permissions of a model from outside its ModelAdmin class. But for example, when I link from one model's admin to onther models's admin changelist, It would be good pratice to check first if the logged in user has the change permission for the other model. So it would be nice if the AdminSite, which is accessible from all ModelAdmin classes has methods to check those permissions for the admin of a given model. My patch adds the has_*_permission() methods from the ModelAdmin class also to the AdminSite class. But those methods in the AdminSite class takes also a model (or a string in the form 'app_label.model_name') and forwards the call to the corresponding method on the given models's admin class.

Attachments (1)

add_permission_checks_to_admin_site.patch (1.3 KB ) - added by Sebastian Noack 14 years ago.

Download all attachments as: .zip

Change History (6)

by Sebastian Noack, 14 years ago

comment:1 by Jacob, 14 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 by Julien Phalip, 14 years ago

Severity: Normal
Type: New feature

comment:3 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 by Tim Graham, 9 years ago

Summary: Enable admin permission checks from outside the ModelAdmin [PATCH]Enable admin permission checks from outside the ModelAdmin
Version: 1.2master
Note: See TracTickets for help on using tickets.
Back to Top