Django

Code

Ticket #6977 (closed: invalid)

Opened 2 years ago

Last modified 8 months ago

should check has_add_permission(), not has_change_permission(), in user add view

Reported by: dfrishberg@ffpir.org Assigned to: mk
Milestone: Component: Authentication
Version: newforms-admin Keywords: nfa-someday
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

django/contrib/auth/admin.py:UserAdmin:add_view(): The first thing that is done is to check whether the user has change permissions. This should be add permissions for the add view.

Attachments

6977.patch (1.5 kB) - added by mk on 07/25/08 02:50:45.

Change History

06/09/08 17:18:52 changed by Karen Tracey <kmtracey@gmail.com>

  • keywords set to nfa-someday.
  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Looks to be the same check as is done for the old admin (see http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/views/auth.py#L11). Since it doesn't seem to have been behavior introduced by nfa, should not block merge.

07/02/08 22:48:43 changed by Karen Tracey <kmtracey@gmail.com>

#7606 is a dup

07/02/08 22:49:51 changed by Karen Tracey <kmtracey@gmail.com>

  • stage changed from Unreviewed to Accepted.

07/25/08 02:50:23 changed by mk

  • owner changed from nobody to mk.
  • status changed from new to assigned.
  • has_patch set to 1.

It's not as simple as just changing has_change_permission to has_add_permission. The place where the user should be redirected to has to be determined with has_change_permission (either continue editing the newly created user or redirect to the admin frontpage).

07/25/08 02:50:45 changed by mk

  • attachment 6977.patch added.

07/25/08 02:51:28 changed by mk

  • component changed from Uncategorized to Authentication.

07/04/09 05:16:06 changed by mk

  • status changed from assigned to closed.
  • resolution set to invalid.

From django/contrib/auth/admin.py:

def add_view(self, request):

# It's an error for a user to have add permission but NOT change # permission for users. If we allowed such users to add users, they # could create superusers, which would mean they would essentially have # the permission to change users. To avoid the problem entirely, we # disallow users from adding users if they don't have change # permission.


Add/Change #6977 (should check has_add_permission(), not has_change_permission(), in user add view)




Change Properties
Action