Opened 5 years ago

Last modified 7 weeks ago

#25281 assigned Cleanup/optimization

Permission strings don't uniquely identify permissions

Reported by: Przemysław Pietrzkiewicz Owned by: tsyplakou
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


APIs related to permissions (e.g. User.has_perm()) take a 'permission string' argument of format "<app label>.<permission codename>" to refer to Permissions.

But each permission is uniquely defined on the model level as a tuple of (content type, permission name). As content type refers to concrete model within a concrete app, we should be using permission string of the format "<app label>.<model name>.<permission codename>".

This becomes a concrete issue once one wants to define custom permissions for their models, and doesn't observe the convention of putting the model name in the permission codenames (or wants to inherit the custom permissions form an abstract model).

See also!searchin/django-developers/permissions/django-developers/ngV5KhLXUrQ/DTfqhG0LRG4J .

Change History (4)

comment:1 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

If someone wants to work on this, please add your implementation plan to the mailing list thread to get feedback first.

comment:2 Changed 8 weeks ago by tsyplakou

Owner: changed from nobody to tsyplakou
Status: newassigned

comment:3 Changed 7 weeks ago by felixxm

Has patch: set

comment:4 Changed 7 weeks ago by Carlton Gibson

Needs documentation: set
Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top