mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 17:42:23 +00:00
Non-admin users can't promote themselves to admin users
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
310ac70a74
commit
777ae059f9
@ -275,6 +275,8 @@ class UserUpdateView(UserMixin, UpdateView):
|
||||
if not self.request.user.registration.is_admin:
|
||||
if "team" in context["registration_form"].fields:
|
||||
del context["registration_form"].fields["team"]
|
||||
if "admin" in context["registration_form"].fields:
|
||||
del context["registration_form"].fields["admin"]
|
||||
del context["registration_form"].fields["email_confirmed"]
|
||||
return context
|
||||
|
||||
@ -286,6 +288,8 @@ class UserUpdateView(UserMixin, UpdateView):
|
||||
if not self.request.user.registration.is_admin:
|
||||
if "team" in registration_form.fields:
|
||||
del registration_form.fields["team"]
|
||||
if "admin" in registration_form.fields:
|
||||
del registration_form.fields["admin"]
|
||||
del registration_form.fields["email_confirmed"]
|
||||
|
||||
if not registration_form.is_valid():
|
||||
|
Loading…
Reference in New Issue
Block a user