Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added staff_member_required and permission check to django.contrib.ad…

…min.views.auth.user_add_stage() -- thanks, Robert Bunting

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e9b19df3ee04b9ea0e9a11012f956e9907579f5d 1 parent 8aa6a94
@adrianholovaty adrianholovaty authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/contrib/admin/views/auth.py
View
4 django/contrib/admin/views/auth.py
@@ -1,3 +1,4 @@
+from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms, template
@@ -5,6 +6,8 @@
from django.http import HttpResponseRedirect
def user_add_stage(request):
+ if not request.user.has_perm('auth.change_user'):
+ raise PermissionDenied
manipulator = UserCreationForm()
if request.method == 'POST':
new_data = request.POST.copy()
@@ -37,3 +40,4 @@ def user_add_stage(request):
'opts': User._meta,
'username_help_text': User._meta.get_field('username').help_text,
}, context_instance=template.RequestContext(request))
+user_add_stage = staff_member_required(user_add_stage)
Please sign in to comment.
Something went wrong with that request. Please try again.