diff --git a/users/migrations/0057_bantype_inhibited_services.py b/users/migrations/0057_bantype_inhibited_services.py new file mode 100644 index 00000000..84a18ae8 --- /dev/null +++ b/users/migrations/0057_bantype_inhibited_services.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-10-11 20:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('machines', '0059_iptype_prefix_v6'), + ('users', '0056_3_bantype_clean'), + ] + + operations = [ + migrations.AddField( + model_name='bantype', + name='inhibited_services', + field=models.ManyToManyField(to='machines.Service'), + ), + ] diff --git a/users/models.py b/users/models.py index cd59b8e5..d4872bac 100644 --- a/users/models.py +++ b/users/models.py @@ -343,7 +343,7 @@ class User(AbstractBaseUser): else: return True - def has_access(self): + def has_access(self): #TODO consider service type """ Renvoie si un utilisateur a accès à internet """ return self.state == User.STATE_ACTIVE \ and not self.is_ban and (self.is_adherent() or self.is_whitelisted) @@ -730,7 +730,11 @@ class BanType(models.Model): name = models.CharField(max_length=255) description = models.TextField(help_text="Description de l'effet et des " "raisons de la blacklist") + inhibited_services = models.ManyToManyField('machines.Service', + help_text="Services désactivés par le ban" + ) # d'autres champs pour décrire les effets viendront si besoin + # Radius ? def __str__(self): return "%s (%s)" % (self.name, self.description)