Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 4252f843 authored by Grizzly's avatar Grizzly

Ajout d'un bouton de supression des banissements

parent f6b04a18
......@@ -47,6 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ ban.date_start }}</td>
<td>{{ ban.date_end }}</td>
<td class="text-right">
{% can_delete ban %}
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
{% acl_end %}
{% can_edit ban %}
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
{% acl_end %}
......
......@@ -55,6 +55,7 @@ urlpatterns = [
name='del-serviceuser'),
url(r'^add_ban/(?P<userid>[0-9]+)$', views.add_ban, name='add-ban'),
url(r'^edit_ban/(?P<banid>[0-9]+)$', views.edit_ban, name='edit-ban'),
url(r'^del-ban/(?P<banid>[0-9]+)$', views.del_ban, name='del-ban'),
url(r'^add_whitelist/(?P<userid>[0-9]+)$',
views.add_whitelist,
name='add-whitelist'),
......
......@@ -404,6 +404,24 @@ def edit_ban(request, ban_instance, **_kwargs):
request
)
@login_required
@can_delete(Ban)
def del_ban(request, ban, **_kwargs):
""" Supprime un banissement"""
if request.method == "POST":
ban.delete()
messages.success(request, "Le banissement a été supprimé")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(ban.user.id)}
))
return form(
{'objet': ban, 'objet_name': 'ban'},
'users/delete.html',
request
)
@login_required
@can_create(Whitelist)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment