Fix perm account_update

This commit is contained in:
Aurélien Delobelle 2016-09-05 01:24:38 +02:00
parent b390220b27
commit a78ad8c4ef

View file

@ -294,7 +294,7 @@ def account_update(request, trigramme):
if request.method == "POST": if request.method == "POST":
# Update attempt # Update attempt
success = False success = False
missing_perm = False missing_perm = True
if request.user.has_perm('kfet.is_team'): if request.user.has_perm('kfet.is_team'):
account_form = AccountForm(request.POST, instance=account) account_form = AccountForm(request.POST, instance=account)
@ -308,6 +308,7 @@ def account_update(request, trigramme):
if (request.user.has_perm('kfet.change_account') if (request.user.has_perm('kfet.change_account')
and account_form.is_valid() and cof_form.is_valid() and account_form.is_valid() and cof_form.is_valid()
and user_form.is_valid()): and user_form.is_valid()):
missing_perm = False
data = {} data = {}
# Fill data for Account.save() # Fill data for Account.save()
put_cleaned_data_in_dict(data, user_form) put_cleaned_data_in_dict(data, user_form)
@ -351,8 +352,6 @@ def account_update(request, trigramme):
success = True success = True
messages.success(request, messages.success(request,
'Informations du compte %s mises à jour' % account.trigramme) 'Informations du compte %s mises à jour' % account.trigramme)
elif not request.user.has_perm('kfet.change_account'):
missing_perm = True
if request.user == account.user: if request.user == account.user:
missing_perm = False missing_perm = False