mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
Use user admin for shells management
This commit is contained in:
parent
74a0ed4a5d
commit
403fb85656
5 changed files with 2 additions and 111 deletions
|
@ -221,6 +221,7 @@ admin.site.register(School, SchoolAdmin)
|
|||
user_admin_site.register(School, SchoolAdmin)
|
||||
admin.site.register(ListRight, ListRightAdmin)
|
||||
admin.site.register(ListShell, ListShellAdmin)
|
||||
user_admin_site.register(ListShell, ListShellAdmin)
|
||||
admin.site.register(Ban, BanAdmin)
|
||||
admin.site.register(EMailAddress, EMailAddressAdmin)
|
||||
admin.site.register(Whitelist, WhitelistAdmin)
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
{% extends 'users/sidebar.html' %}
|
||||
{% comment %}
|
||||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
||||
se veut agnostique au réseau considéré, de manière à être installable en
|
||||
quelques clics.
|
||||
|
||||
Copyright © 2017 Gabriel Détraz
|
||||
Copyright © 2017 Goulven Kermarec
|
||||
Copyright © 2017 Augustin Lemesle
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
|
||||
{% load bootstrap3 %}
|
||||
{% load acl %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "Users" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans "List of shells" %}</h2>
|
||||
{% can_create ListShell %}
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-shell' %}"><i class="fa fa-plus"></i>{% trans " Add a shell" %}</a>
|
||||
{% acl_end %}
|
||||
{% include 'users/aff_shell.html' with shell_list=shell_list %}
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
{% endblock %}
|
||||
|
|
@ -71,7 +71,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</a>
|
||||
{% acl_end %}
|
||||
{% can_view_all ListShell %}
|
||||
<a class="list-group-item list-group-item-info" href="{% url 'users:index-shell' %}">
|
||||
<a class="list-group-item list-group-item-info" href="{% url 'user_admin:users_listshell_changelist' %}">
|
||||
<i class="fa fa-list-ul"></i>
|
||||
{% trans "Shells" %}
|
||||
</a>
|
||||
|
|
|
@ -82,17 +82,9 @@ urlpatterns = [
|
|||
views.edit_listright,
|
||||
name='edit-listright'),
|
||||
url(r'^del_listright/$', views.del_listright, name='del-listright'),
|
||||
url(r'^add_shell/$', views.add_shell, name='add-shell'),
|
||||
url(r'^edit_shell/(?P<listshellid>[0-9]+)$',
|
||||
views.edit_shell,
|
||||
name='edit-shell'),
|
||||
url(r'^del_shell/(?P<listshellid>[0-9]+)$',
|
||||
views.del_shell,
|
||||
name='del-shell'),
|
||||
url(r'^profil/(?P<userid>[0-9]+)$', views.profil, name='profil'),
|
||||
url(r'^index_ban/$', views.index_ban, name='index-ban'),
|
||||
url(r'^index_white/$', views.index_white, name='index-white'),
|
||||
url(r'^index_shell/$', views.index_shell, name='index-shell'),
|
||||
url(r'^index_listright/$', views.index_listright, name='index-listright'),
|
||||
url(r'^index_serviceusers/$',
|
||||
views.index_serviceusers,
|
||||
|
|
|
@ -597,54 +597,6 @@ def edit_email_settings(request, user_instance, **_kwargs):
|
|||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_create(ListShell)
|
||||
def add_shell(request):
|
||||
""" Ajouter un shell à la base de donnée"""
|
||||
shell = ShellForm(request.POST or None)
|
||||
if shell.is_valid():
|
||||
shell.save()
|
||||
messages.success(request, _("The shell was added."))
|
||||
return redirect(reverse('users:index-shell'))
|
||||
return form(
|
||||
{'userform': shell, 'action_name': _("Add a shell")},
|
||||
'users/user.html',
|
||||
request
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_edit(ListShell)
|
||||
def edit_shell(request, shell_instance, **_kwargs):
|
||||
""" Editer un shell à partir du listshellid"""
|
||||
shell = ShellForm(request.POST or None, instance=shell_instance)
|
||||
if shell.is_valid():
|
||||
if shell.changed_data:
|
||||
shell.save()
|
||||
messages.success(request, _("The shell was edited."))
|
||||
return redirect(reverse('users:index-shell'))
|
||||
return form(
|
||||
{'userform': shell, 'action_name': _("Edit a shell")},
|
||||
'users/user.html',
|
||||
request
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_delete(ListShell)
|
||||
def del_shell(request, shell, **_kwargs):
|
||||
"""Destruction d'un shell"""
|
||||
if request.method == "POST":
|
||||
shell.delete()
|
||||
messages.success(request, _("The shell was deleted."))
|
||||
return redirect(reverse('users:index-shell'))
|
||||
return form(
|
||||
{'objet': shell, 'objet_name': 'shell'},
|
||||
'users/delete.html',
|
||||
request
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_create(ListRight)
|
||||
def add_listright(request):
|
||||
|
@ -831,18 +783,6 @@ def index_school(request):
|
|||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_view_all(ListShell)
|
||||
def index_shell(request):
|
||||
""" Affiche l'ensemble des shells"""
|
||||
shell_list = ListShell.objects.order_by('shell')
|
||||
return render(
|
||||
request,
|
||||
'users/index_shell.html',
|
||||
{'shell_list': shell_list}
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@can_view_all(ListRight)
|
||||
def index_listright(request):
|
||||
|
|
Loading…
Reference in a new issue