Opened 7 years ago

Closed 2 years ago

Last modified 2 years ago

#9057 closed New feature (fixed)

Allow disabling contrib.auth auto creation of permissions

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

Description

If you wan't to create permissions and a superuser automatically in your own it's easy. Just follow the pattern used in contrib.auth

Then all you need to do is make contrib.auth stop creating permissions and superuser as well

Attachments (3)

9057.1.patch (576 bytes) - added by hvendelbo 7 years ago.
Add extra global settings
9057.2.patch (1.2 KB) - added by hvendelbo 7 years ago.
Check settings before creating permissions and superuser
9057.diff (3.7 KB) - added by koenb 4 years ago.
patch with no_default_permission meta option

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by hvendelbo

Add extra global settings

Changed 7 years ago by hvendelbo

Check settings before creating permissions and superuser

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

A few issue here:

  1. This patch seems to be trying to slip in a configurable user-model. I can't see how that's related to the problem at hand.
  2. One patch, please, not two. I looked at the last patch, thinking it was the most up-to-date version and it looked incomplete. Then I realised that I had to read both at once.
  3. I'm -1 on including this at the moment. It's two extra settings, plus documentation (which isn't included here) to support something that happens once at syncdb time. If you don't want those permissions you can go in and delete them or write a script to do so. I'm relatively unconvinced that there's a really large use-case that is being overlooked by this not being present.

comment:2 Changed 6 years ago by DarwinSurvivor

While I'm not sure about the superuser part, I would find the ability to dissable auto-created permissions VERY usefull in the site I am currently designing.

Not only are there 3 permissions created per model, but the admin page does not even separate the auto-created ones from the purposely-created ones. My site has over 30 models (very complex research site) and having to go in and delete all the auto-created permissions every time I add a model is VERY annoying.

This seems like a simple fix and other than the missing tests/docs (which look like they would take all of 5 minutes to write), I am all for this.

comment:3 Changed 4 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.auth

comment:4 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

Changed 4 years ago by koenb

patch with no_default_permission meta option

comment:5 Changed 4 years ago by koenb

  • Easy pickings unset
  • Needs documentation set
  • UI/UX unset

This patch has a different take: make it a meta option per model (called "no_default_permissions") to prevent creating the three default permissions for that model.

Added a test in a new folder regressiontests/auth_permissions since I did not know where to put them otherwise.

comment:6 Changed 4 years ago by aaugustin

  • Triage Stage changed from Design decision needed to Accepted

comment:7 Changed 2 years ago by timo

  • Needs documentation unset
  • Summary changed from allow override of contrib.auth auto creation of permissions and superuser to Allow disabling contrib.auth auto creation of permissions
  • Version changed from 1.0 to master

Updating existing patch: PR

comment:8 Changed 2 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In ddae74b64ccb1173e3f2f06d54dd45643130f9e0:

Fixed #9057 -- Added default_permissions model meta option.

Thanks hvendelbo for the suggestion and koenb for the draft patch.

comment:9 Changed 2 years ago by Tim Graham <timograham@…>

In 453915bb1272c9a9189a741e6a9b9246edfcbd03:

SQLite test fix -- refs #9057

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