Commit 5674ce0b authored by Vincent Le gallic's avatar Vincent Le gallic

Changement du protocole : le masque contient les droits qu'on *ne* veut *pas*

parent e8c9d8e9
......@@ -137,7 +137,7 @@ def _gerer_NKError(request, exc, form=None):
typ = str(typ).replace("<", "&lt;").replace(">", "&gt;")
return HttpResponse("La gestion de cette erreur n'est pas prévue :\n%s : %s" % (typ, exc))
def login_NK(request, username, password, masque=[["all"], ["all"], True]):
def login_NK(request, username, password, masque=[[], [], False]):
"""Ouvre une connexion au serveur NK2015 par username/password
Renvoie dans tous les cas un objet HttpResponse[Redirect] utilisable directement"""
form = LoginForm(label_suffix=" :")
......@@ -535,7 +535,8 @@ def login_page(request):
username = form.cleaned_data["username"]
password = form.cleaned_data["password"]
masque_droits = form.cleaned_data["droits"]
dico_masques = {'all': [['all'], ['all'], True], 'restricted': [['basic,note'], [], False]}
restricted = ["wei", "overforced", "transactions_admin", "chgpass", "comptes", "boutons", "admin"]
dico_masques = {'all': [[], [], False], 'restricted': [restricted, restricted, True]}
masque_droits = dico_masques[masque_droits]
# On tente un login
return login_NK(request, username, password, masque_droits)
......
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