diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 68f63af..94541bb 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -38,12 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc., Changer le mot de passe - {% if is_bureau %} - - - Ajouter un droit - - {% endif %} Historique diff --git a/users/templates/users/sidebar.html b/users/templates/users/sidebar.html index 9b3a6a2..6290d40 100644 --- a/users/templates/users/sidebar.html +++ b/users/templates/users/sidebar.html @@ -49,10 +49,4 @@ with this program; if not, write to the Free Software Foundation, Inc., Clef {% endif %} - {% if is_bureau %} - - - Retirer un droit - - {% endif %} {% endblock %} diff --git a/users/urls.py b/users/urls.py index 92239e4..bcdf665 100644 --- a/users/urls.py +++ b/users/urls.py @@ -21,8 +21,6 @@ urlpatterns = [ url(r'^del_adhesion/(?P[0-9]+)$', views.del_adhesion, name='del-adhesion'), url(r'^index_adhesion/$', views.index_adhesion, name='index-adhesion'), url(r'^history/(?Padhesion)/(?P[0-9]+)$', views.history, name='history'), - url(r'^add_right/(?P[0-9]+)$', views.add_right, name='add-right'), - url(r'^del_right/$', views.del_right, name='del-right'), url(r'^process/(?P[a-z0-9]{32})/$', views.process, name='process'), url(r'^history/(?Puser)/(?P[0-9]+)$', views.history, name='history'), url(r'^$', views.index, name='index'), diff --git a/users/views.py b/users/views.py index c064506..04e14d4 100644 --- a/users/views.py +++ b/users/views.py @@ -129,51 +129,6 @@ def password(request, userid): return form({'userform': u_form}, 'users/user.html', request) -@login_required -@permission_required('bureau') -def add_right(request, userid): - """ Ajout d'un droit à un user, need droit bureau """ - try: - 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.save(commit=False) - right.user = user - try: - with transaction.atomic(), reversion.create_revision(): - reversion.set_user(request.user) - reversion.set_comment("Ajout du droit %s" % right.right) - right.save() - messages.success(request, "Droit ajouté") - except IntegrityError: - pass - return redirect("/users/profil/" + userid) - return form({'userform': right}, 'users/user.html', request) - - -@login_required -@permission_required('bureau') -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(): - reversion.set_user(request.user) - reversion.set_comment( - "Retrait des droit %s" % ','.join(str(deleted_right) for deleted_right in right_del)) - right_del.delete() - 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 def index_clef(request): clef_list = Clef.objects.all().order_by('nom')