Remove superuser function.
This commit is contained in:
parent
bd3bf9fb6f
commit
36ca264931
|
@ -35,7 +35,7 @@ class UserNewForm(ModelForm, CssClassMixin):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
exclude = ('username', 'password', 'is_staff', 'last_login', 'date_joined', 'user_permissions')
|
exclude = ('username', 'password', 'is_staff', 'is_superuser', 'last_login', 'date_joined', 'user_permissions')
|
||||||
|
|
||||||
|
|
||||||
class UserEditForm(ModelForm, CssClassMixin):
|
class UserEditForm(ModelForm, CssClassMixin):
|
||||||
|
@ -44,13 +44,13 @@ class UserEditForm(ModelForm, CssClassMixin):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
exclude = ('password', 'is_staff', 'last_login', 'date_joined', 'user_permissions')
|
exclude = ('password', 'is_staff', 'is_superuser', 'last_login', 'date_joined', 'user_permissions')
|
||||||
|
|
||||||
|
|
||||||
class UsernameForm(ModelForm, CssClassMixin):
|
class UsernameForm(ModelForm, CssClassMixin):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
exclude = ('first_name', 'last_name', 'email', 'is_active','is_superuser', 'groups', 'password', 'is_staff', 'last_login', 'date_joined', 'user_permissions')
|
exclude = ('first_name', 'last_name', 'email', 'is_active', 'is_superuser', 'groups', 'password', 'is_staff', 'last_login', 'date_joined', 'user_permissions')
|
||||||
|
|
||||||
|
|
||||||
class ProfileForm(ModelForm, CssClassMixin):
|
class ProfileForm(ModelForm, CssClassMixin):
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 746 B |
Binary file not shown.
Before Width: | Height: | Size: 752 B |
|
@ -17,23 +17,4 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.superuser_link').click(function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
link = $(this);
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: link.attr('href'),
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data) {
|
|
||||||
if (data.superuser) {
|
|
||||||
newclass = 'superuser';
|
|
||||||
} else {
|
|
||||||
newclass = 'normaluser';
|
|
||||||
}
|
|
||||||
link.removeClass('superuser normaluser').addClass(newclass);
|
|
||||||
link.attr('href', data.link);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
|
@ -14,20 +14,3 @@ a.status_link.inactive span {
|
||||||
height: 16px;
|
height: 16px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.superuser_link.superuser span {
|
|
||||||
background-image: url(../images/icons/meeting-chair.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
a.superuser_link.normaluser span {
|
|
||||||
background-image: url(../images/icons/im-user.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
|
@ -91,11 +91,6 @@
|
||||||
title="{%trans 'Change status (active/inactive)' %}">
|
title="{%trans 'Change status (active/inactive)' %}">
|
||||||
<span></span>
|
<span></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="superuser_link {% if user.is_superuser %}superuser{% else %}normaluser{% endif %}"
|
|
||||||
href="{% if user.is_superuser %}{% url user_normaluser user.id %}{% else %}{% url user_superuser user.id %}{% endif %}"
|
|
||||||
title="{%trans 'Change administrator rights (Superuser/Normal user)' %}">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -51,18 +51,6 @@ urlpatterns = patterns('participant.views',
|
||||||
name='user_inactive',
|
name='user_inactive',
|
||||||
),
|
),
|
||||||
|
|
||||||
url(r'^(?P<user_id>\d+)/superuser/$',
|
|
||||||
'user_set_superuser',
|
|
||||||
{'superuser': True},
|
|
||||||
name='user_superuser',
|
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<user_id>\d+)/normaluser/$',
|
|
||||||
'user_set_superuser',
|
|
||||||
{'superuser': False},
|
|
||||||
name='user_normaluser',
|
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^import$',
|
url(r'^import$',
|
||||||
'user_import',
|
'user_import',
|
||||||
name='user_import',
|
name='user_import',
|
||||||
|
|
|
@ -187,25 +187,6 @@ def user_delete(request, user_id):
|
||||||
gen_confirm_form(request, _('Do you really want to delete <b>%s</b>?') % user, reverse('user_delete', args=[user_id]))
|
gen_confirm_form(request, _('Do you really want to delete <b>%s</b>?') % user, reverse('user_delete', args=[user_id]))
|
||||||
return redirect(reverse('user_overview'))
|
return redirect(reverse('user_overview'))
|
||||||
|
|
||||||
@permission_required('participant.can_manage_participant')
|
|
||||||
@template('confirm.html')
|
|
||||||
def user_set_superuser(request, user_id, superuser=True):
|
|
||||||
try:
|
|
||||||
user = User.objects.get(pk=user_id)
|
|
||||||
user.is_superuser = superuser
|
|
||||||
user.save()
|
|
||||||
except User.DoesNotExist:
|
|
||||||
messages.error(request, _('Participant %d does not exist.') % int(user_id))
|
|
||||||
|
|
||||||
if request.is_ajax():
|
|
||||||
if superuser:
|
|
||||||
link = reverse('user_normaluser', args=[user.id])
|
|
||||||
else:
|
|
||||||
link = reverse('user_superuser', args=[user.id])
|
|
||||||
return ajax_request({'superuser': superuser,
|
|
||||||
'link': link})
|
|
||||||
return redirect(reverse('user_overview'))
|
|
||||||
|
|
||||||
@permission_required('participant.can_manage_participant')
|
@permission_required('participant.can_manage_participant')
|
||||||
@template('confirm.html')
|
@template('confirm.html')
|
||||||
def user_set_active(request, user_id, active=True):
|
def user_set_active(request, user_id, active=True):
|
||||||
|
|
Loading…
Reference in New Issue