From c14f172764c4ad917daecdec76260d67a74a5caf Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Wed, 15 Apr 2020 18:42:36 +0000 Subject: [PATCH] Forbid user from forcing out another user with a free access --- .../migrations/0069_auto_20200415_2012.py | 20 +++++++++++++++++++ users/forms.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 preferences/migrations/0069_auto_20200415_2012.py diff --git a/preferences/migrations/0069_auto_20200415_2012.py b/preferences/migrations/0069_auto_20200415_2012.py new file mode 100644 index 00000000..94690d0e --- /dev/null +++ b/preferences/migrations/0069_auto_20200415_2012.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.28 on 2020-04-15 18:12 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0068_optionaluser_self_force_move_disabled_user_room'), + ] + + operations = [ + migrations.AlterField( + model_name='optionaluser', + name='self_force_move_disabled_user_room', + field=models.BooleanField(default=False, help_text='Users can select a room occupied by a user with a disabled connection.'), + ), + ] diff --git a/users/forms.py b/users/forms.py index 369290aa..322c715e 100644 --- a/users/forms.py +++ b/users/forms.py @@ -366,7 +366,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): # If a user already is register for this room # but their connection has expired, allow force move user = Adherent.objects.get(room=room) - if user and not user.is_connected(): + if user and not user.has_access(): remove_user_room(room) except Adherent.DoesNotExist: pass