mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Suppression de superuser
This commit is contained in:
parent
d2946a94b5
commit
6f3fc983ac
3 changed files with 14 additions and 1 deletions
|
@ -58,7 +58,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% for user in superuser_right %}
|
{% for user in superuser_right %}
|
||||||
<li class="list-group-item col-xs-12 col-sm-6 col-md-4" style="border:none;">
|
<li class="list-group-item col-xs-12 col-sm-6 col-md-4" style="border:none;">
|
||||||
{{user}}
|
{{user}}
|
||||||
<a role="button" href="" title="{{ desc|default:"Supprimer" }}">
|
<a role="button" href="{% url 'users:del-superuser' user.pk %}" title="{{ desc|default:"Supprimer" }}">
|
||||||
<i class="fa fa-times" style="color:red"></i>
|
<i class="fa fa-times" style="color:red"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -43,6 +43,9 @@ urlpatterns = [
|
||||||
url(r'^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$',
|
url(r'^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$',
|
||||||
views.del_group,
|
views.del_group,
|
||||||
name='del-group'),
|
name='del-group'),
|
||||||
|
url(r'^del_superuser/(?P<userid>[0-9]+)$',
|
||||||
|
views.del_superuser,
|
||||||
|
name='del-superuser'),
|
||||||
url(r'^new_serviceuser/$', views.new_serviceuser, name='new-serviceuser'),
|
url(r'^new_serviceuser/$', views.new_serviceuser, name='new-serviceuser'),
|
||||||
url(r'^edit_serviceuser/(?P<serviceuserid>[0-9]+)$',
|
url(r'^edit_serviceuser/(?P<serviceuserid>[0-9]+)$',
|
||||||
views.edit_serviceuser,
|
views.edit_serviceuser,
|
||||||
|
|
|
@ -294,6 +294,16 @@ def del_group(request, user, listrightid, **_kwargs):
|
||||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@can_edit(User, 'groups')
|
||||||
|
def del_superuser(request, user, **_kwargs):
|
||||||
|
"""Remove the superuser right of an user."""
|
||||||
|
user.is_superuser = False
|
||||||
|
user.save()
|
||||||
|
messages.success(request, "%s n'est plus superuser" % user)
|
||||||
|
return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_create(ServiceUser)
|
@can_create(ServiceUser)
|
||||||
def new_serviceuser(request):
|
def new_serviceuser(request):
|
||||||
|
|
Loading…
Reference in a new issue