Verified Commit a139c233 authored by erdnaxe's avatar erdnaxe 🎇

Remove add/remove right views

parent ec66f980
...@@ -38,12 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -38,12 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="glyphicon glyphicon-lock"></i> <i class="glyphicon glyphicon-lock"></i>
Changer le mot de passe Changer le mot de passe
</a> </a>
{% if is_bureau %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-right' %}">
<i class="glyphicon glyphicon-ok"></i>
Ajouter un droit
{% endif %}
<a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' %}"> <a class="btn btn-info btn-sm" role="button" href="{% url 'users:history' 'user' %}">
<i class="glyphicon glyphicon-time"></i> <i class="glyphicon glyphicon-time"></i>
Historique Historique
...@@ -49,10 +49,4 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -49,10 +49,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Clef Clef
</a> </a>
{% endif %} {% endif %}
{% if is_bureau %}
<a class="list-group-item list-group-item-danger" href="{% url "users:del-right" %}">
<i class="glyphicon glyphicon-trash"></i>
Retirer un droit
{% endif %}
{% endblock %} {% endblock %}
...@@ -21,8 +21,6 @@ urlpatterns = [ ...@@ -21,8 +21,6 @@ urlpatterns = [
url(r'^del_adhesion/(?P<adhesionid>[0-9]+)$', views.del_adhesion, name='del-adhesion'), url(r'^del_adhesion/(?P<adhesionid>[0-9]+)$', views.del_adhesion, name='del-adhesion'),
url(r'^index_adhesion/$', views.index_adhesion, name='index-adhesion'), url(r'^index_adhesion/$', views.index_adhesion, name='index-adhesion'),
url(r'^history/(?P<object>adhesion)/(?P<id>[0-9]+)$', views.history, name='history'), url(r'^history/(?P<object>adhesion)/(?P<id>[0-9]+)$', views.history, name='history'),
url(r'^add_right/(?P<userid>[0-9]+)$', views.add_right, name='add-right'),
url(r'^del_right/$', views.del_right, name='del-right'),
url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'), url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'),
url(r'^history/(?P<object>user)/(?P<id>[0-9]+)$', views.history, name='history'), url(r'^history/(?P<object>user)/(?P<id>[0-9]+)$', views.history, name='history'),
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
...@@ -129,51 +129,6 @@ def password(request, userid): ...@@ -129,51 +129,6 @@ def password(request, userid):
return form({'userform': u_form}, 'users/user.html', request) return form({'userform': u_form}, 'users/user.html', request)
def add_right(request, userid):
""" Ajout d'un droit à un user, need droit bureau """
user = User.objects.get(pk=userid)
except User.DoesNotExist:
messages.error(request, "Utilisateur inexistant")
return redirect("/users/")
right = RightForm(request.POST or None)
if right.is_valid():
right =
right.user = user
with transaction.atomic(), reversion.create_revision():
reversion.set_comment("Ajout du droit %s" % right.right)
messages.success(request, "Droit ajouté")
except IntegrityError:
return redirect("/users/profil/" + userid)
return form({'userform': right}, 'users/user.html', request)
def del_right(request):
""" Supprimer un droit à un user, need droit bureau """
user_right_list = dict()
for right in ListRight.objects.all():
user_right_list[right] = DelRightForm(right, request.POST or None)
for keys, right_item in user_right_list.items():
if right_item.is_valid():
right_del = right_item.cleaned_data['rights']
with transaction.atomic(), reversion.create_revision():
"Retrait des droit %s" % ','.join(str(deleted_right) for deleted_right in right_del))
messages.success(request, "Droit retiré avec succès")
return redirect("/users/")
return form({'userform': user_right_list}, 'users/del_right.html', request)
@user_is_in_campus @user_is_in_campus
def index_clef(request): def index_clef(request):
clef_list = Clef.objects.all().order_by('nom') clef_list = Clef.objects.all().order_by('nom')
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