8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00

Migration: Squash all migrations

This commit is contained in:
Maël Kervella 2018-03-21 18:27:20 +00:00
parent 942a3e3cbd
commit 2ce7cfb115
5 changed files with 2133 additions and 0 deletions

View file

@ -0,0 +1,249 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-20 19:57
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:
# cotisations.migrations.0026_auto_20171028_0126
# Imported from cotisations.migrations.0026_auto_20171028_0126
##############################################################
def create_type(apps, schema_editor):
Cotisation = apps.get_model('cotisations', 'Cotisation')
Vente = apps.get_model('cotisations', 'Vente')
Article = apps.get_model('cotisations', 'Article')
db_alias = schema_editor.connection.alias
articles = Article.objects.using(db_alias).all()
ventes = Vente.objects.using(db_alias).all()
cotisations = Cotisation.objects.using(db_alias).all()
for article in articles:
if article.iscotisation:
article.type_cotisation='All'
article.save(using=db_alias)
for vente in ventes:
if vente.iscotisation:
vente.type_cotisation='All'
vente.save(using=db_alias)
for cotisation in cotisations:
cotisation.type_cotisation='All'
cotisation.save(using=db_alias)
def delete_type(apps, schema_editor):
Vente = apps.get_model('cotisations', 'Vente')
Article = apps.get_model('cotisations', 'Article')
db_alias = schema_editor.connection.alias
articles = Articles.objects.using(db_alias).all()
ventes = Vente.objects.using(db_alias).all()
for article in articles:
if article.type_cotisation:
article.iscotisation=True
else:
article.iscotisation=False
article.save(using=db_alias)
for vente in ventes:
if vente.iscotisation:
vente.iscotisation=True
else:
vente.iscotisation=False
vente.save(using=db_alias)
class Migration(migrations.Migration):
replaces = [('cotisations', '0001_initial'), ('cotisations', '0002_remove_facture_article'), ('cotisations', '0003_auto_20160702_1448'), ('cotisations', '0004_auto_20160702_1528'), ('cotisations', '0005_auto_20160702_1532'), ('cotisations', '0006_auto_20160702_1534'), ('cotisations', '0007_auto_20160702_1543'), ('cotisations', '0008_auto_20160702_1614'), ('cotisations', '0009_remove_cotisation_user'), ('cotisations', '0010_auto_20160702_1840'), ('cotisations', '0011_auto_20160702_1911'), ('cotisations', '0012_auto_20160704_0118'), ('cotisations', '0013_auto_20160711_2240'), ('cotisations', '0014_auto_20160712_0245'), ('cotisations', '0015_auto_20160714_2142'), ('cotisations', '0016_auto_20160715_0110'), ('cotisations', '0017_auto_20170718_2329'), ('cotisations', '0018_paiement_type_paiement'), ('cotisations', '0019_auto_20170819_0055'), ('cotisations', '0020_auto_20170819_0057'), ('cotisations', '0021_auto_20170819_0104'), ('cotisations', '0022_auto_20170824_0128'), ('cotisations', '0023_auto_20170902_1303'), ('cotisations', '0024_auto_20171015_2033'), ('cotisations', '0025_article_type_user'), ('cotisations', '0026_auto_20171028_0126'), ('cotisations', '0027_auto_20171029_1156'), ('cotisations', '0028_auto_20171231_0007')]
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('prix', models.DecimalField(decimal_places=2, max_digits=5)),
],
),
migrations.CreateModel(
name='Banque',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Facture',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cheque', models.CharField(max_length=255)),
('number', models.IntegerField()),
('date', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=255)),
('prix', models.DecimalField(decimal_places=2, max_digits=5)),
('article', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='cotisations.Article')),
('banque', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='cotisations.Banque')),
],
),
migrations.CreateModel(
name='Paiement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('moyen', models.CharField(max_length=255)),
('type_paiement', models.IntegerField(choices=[(0, 'Autre'), (1, 'Chèque')], default=0)),
],
),
migrations.AddField(
model_name='facture',
name='paiement',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='cotisations.Paiement'),
),
migrations.AddField(
model_name='facture',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
),
migrations.RemoveField(
model_name='facture',
name='article',
),
migrations.AlterField(
model_name='facture',
name='banque',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='cotisations.Banque'),
),
migrations.RemoveField(
model_name='facture',
name='name',
),
migrations.RemoveField(
model_name='facture',
name='prix',
),
migrations.AlterField(
model_name='facture',
name='cheque',
field=models.CharField(blank=True, max_length=255),
),
migrations.CreateModel(
name='Cotisation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date_start', models.DateTimeField()),
('date_end', models.DateTimeField()),
],
),
migrations.AddField(
model_name='article',
name='iscotisation',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='facture',
name='valid',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='article',
name='duration',
field=models.PositiveIntegerField(blank=True, help_text='Durée exprimée en mois entiers', null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.CreateModel(
name='Vente',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('prix', models.DecimalField(decimal_places=2, max_digits=5)),
('iscotisation', models.BooleanField()),
('duration', models.PositiveIntegerField(blank=True, help_text='Durée exprimée en mois entiers', null=True)),
('facture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cotisations.Facture')),
('number', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)])),
('type_cotisation', models.CharField(blank=True, choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], max_length=255, null=True)),
],
),
migrations.RemoveField(
model_name='facture',
name='number',
),
migrations.AddField(
model_name='facture',
name='control',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='cotisation',
name='vente',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='cotisations.Vente'),
preserve_default=False,
),
migrations.AlterField(
model_name='article',
name='name',
field=models.CharField(max_length=255, unique=True),
),
migrations.AddField(
model_name='article',
name='type_user',
field=models.CharField(choices=[('Adherent', 'Adherent'), ('Club', 'Club'), ('All', 'All')], default='All', max_length=255),
),
migrations.AddField(
model_name='article',
name='type_cotisation',
field=models.CharField(blank=True, choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], default=None, max_length=255, null=True),
),
migrations.AddField(
model_name='cotisation',
name='type_cotisation',
field=models.CharField(choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], default='All', max_length=255),
),
migrations.RunPython(
code=create_type,
reverse_code=delete_type,
),
migrations.RemoveField(
model_name='article',
name='iscotisation',
),
migrations.RemoveField(
model_name='vente',
name='iscotisation',
),
migrations.AlterField(
model_name='article',
name='name',
field=models.CharField(max_length=255),
),
migrations.AlterModelOptions(
name='article',
options={'permissions': (('view_article', 'Peut voir un objet article'),)},
),
migrations.AlterModelOptions(
name='banque',
options={'permissions': (('view_banque', 'Peut voir un objet banque'),)},
),
migrations.AlterModelOptions(
name='cotisation',
options={'permissions': (('view_cotisation', 'Peut voir un objet cotisation'), ('change_all_cotisation', 'Superdroit, peut modifier toutes les cotisations'))},
),
migrations.AlterModelOptions(
name='facture',
options={'permissions': (('change_facture_control', "Peut changer l'etat de controle"), ('change_facture_pdf', 'Peut éditer une facture pdf'), ('view_facture', 'Peut voir un objet facture'), ('change_all_facture', 'Superdroit, peut modifier toutes les factures'))},
),
migrations.AlterModelOptions(
name='paiement',
options={'permissions': (('view_paiement', 'Peut voir un objet paiement'),)},
),
migrations.AlterModelOptions(
name='vente',
options={'permissions': (('view_vente', 'Peut voir un objet vente'), ('change_all_vente', 'Superdroit, peut modifier toutes les ventes'))},
),
]

View file

@ -0,0 +1,537 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-21 17:45
from __future__ import unicode_literals
import datetime
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import macaddress.fields
import machines.models
# Imported from machines.migrations.0063_auto_20171020_0040
###########################################################
def new_default_soa():
return SOA.objects.get_or_create(name="SOA to edit", mail="postmaser@example.com")[0].pk
class Migration(migrations.Migration):
replaces = [('machines', '0001_initial'), ('machines', '0002_auto_20160703_1444'), ('machines', '0003_auto_20160703_1450'), ('machines', '0004_auto_20160703_1451'), ('machines', '0005_auto_20160703_1523'), ('machines', '0006_auto_20160703_1813'), ('machines', '0007_auto_20160703_1816'), ('machines', '0008_remove_interface_ipv6'), ('machines', '0009_auto_20160703_2358'), ('machines', '0010_auto_20160704_0104'), ('machines', '0011_auto_20160704_0105'), ('machines', '0012_auto_20160704_0118'), ('machines', '0013_auto_20160705_1014'), ('machines', '0014_auto_20160706_1220'), ('machines', '0015_auto_20160707_0105'), ('machines', '0016_auto_20160708_1633'), ('machines', '0017_auto_20160708_1645'), ('machines', '0018_auto_20160708_1813'), ('machines', '0019_auto_20160718_1141'), ('machines', '0020_auto_20160718_1849'), ('machines', '0021_auto_20161006_1943'), ('machines', '0022_auto_20161011_1829'), ('machines', '0023_iplist_ip_type'), ('machines', '0024_machinetype_need_infra'), ('machines', '0025_auto_20161023_0038'), ('machines', '0026_auto_20161026_1348'), ('machines', '0027_alias'), ('machines', '0028_iptype_domaine_ip'), ('machines', '0029_iptype_domaine_range'), ('machines', '0030_auto_20161118_1730'), ('machines', '0031_auto_20161119_1709'), ('machines', '0032_auto_20161119_1850'), ('machines', '0033_extension_need_infra'), ('machines', '0034_iplist_need_infra'), ('machines', '0035_auto_20161224_1201'), ('machines', '0036_auto_20161224_1204'), ('machines', '0037_domain_cname'), ('machines', '0038_auto_20161224_1721'), ('machines', '0039_auto_20161224_1732'), ('machines', '0040_remove_interface_dns'), ('machines', '0041_remove_ns_interface'), ('machines', '0042_ns_ns'), ('machines', '0043_auto_20170721_0350'), ('machines', '0044_auto_20170808_0233'), ('machines', '0045_auto_20170808_0348'), ('machines', '0046_auto_20170808_1423'), ('machines', '0047_auto_20170809_0606'), ('machines', '0048_auto_20170823_2315'), ('machines', '0049_vlan'), ('machines', '0050_auto_20170826_0022'), ('machines', '0051_iptype_vlan'), ('machines', '0052_auto_20170828_2322'), ('machines', '0053_text'), ('machines', '0054_text_zone'), ('machines', '0055_nas'), ('machines', '0056_nas_port_access_mode'), ('machines', '0057_nas_autocapture_mac'), ('machines', '0058_auto_20171002_0350'), ('machines', '0059_iptype_prefix_v6'), ('machines', '0060_iptype_ouverture_ports'), ('machines', '0061_auto_20171015_2033'), ('machines', '0062_extension_origin_v6'), ('machines', '0063_auto_20171020_0040'), ('machines', '0064_auto_20171115_0253'), ('machines', '0065_auto_20171115_1514'), ('machines', '0066_srv'), ('machines', '0067_auto_20171116_0152'), ('machines', '0068_auto_20171116_0252'), ('machines', '0069_auto_20171116_0822'), ('machines', '0070_auto_20171231_1947'), ('machines', '0071_auto_20171231_2100'), ('machines', '0072_auto_20180108_1822'), ('machines', '0073_auto_20180128_2203'), ('machines', '0074_auto_20180129_0352'), ('machines', '0075_auto_20180130_0052'), ('machines', '0076_auto_20180130_1623')]
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Machine',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
('name', models.CharField(blank=True, help_text='Optionnel', max_length=255, null=True)),
('active', models.BooleanField(default=True)),
],
),
migrations.CreateModel(
name='MachineType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Interface',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ipv6', models.GenericIPAddressField(protocol='IPv6')),
('mac_address', macaddress.fields.MACAddressField(integer=True)),
('details', models.CharField(max_length=255)),
('name', models.CharField(blank=True, max_length=255, unique=True)),
],
),
migrations.CreateModel(
name='IpList',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ipv4', models.GenericIPAddressField(protocol='IPv4', unique=True)),
('ip_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.IpType')),
],
),
migrations.AddField(
model_name='interface',
name='ipv4',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'),
),
migrations.AddField(
model_name='interface',
name='machine',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Machine'),
),
migrations.AlterField(
model_name='interface',
name='mac_address',
field=macaddress.fields.MACAddressField(integer=True, unique=True),
),
migrations.RenameField(
model_name='interface',
old_name='name',
new_name='dns',
),
migrations.AlterField(
model_name='interface',
name='details',
field=models.CharField(blank=True, max_length=255),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(max_length=255, unique=True),
),
migrations.RemoveField(
model_name='interface',
name='ipv6',
),
migrations.AlterField(
model_name='interface',
name='mac_address',
field=macaddress.fields.MACAddressField(integer=False, max_length=17, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text='Obligatoire et unique', max_length=255, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text='Obligatoire et unique, doit se terminer en .rez et ne pas comporter de points', max_length=255, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .example et ne pas comporter d'autres points", max_length=255, unique=True),
),
migrations.CreateModel(
name='Extension',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points", max_length=255, unique=True),
),
migrations.AddField(
model_name='interface',
name='type',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.MachineType'),
preserve_default=False,
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(max_length=255, unique=True),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text="Obligatoire et unique, doit se terminer par exemple en .rez et ne pas comporter d'autres points", max_length=255, unique=True),
),
migrations.CreateModel(
name='IpType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(max_length=255)),
('need_infra', models.BooleanField(default=False)),
('extension', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
('domaine_ip', models.GenericIPAddressField(protocol='IPv4')),
('domaine_range', models.IntegerField(validators=[django.core.validators.MinValueValidator(16), django.core.validators.MaxValueValidator(32)])),
],
),
migrations.AddField(
model_name='machinetype',
name='ip_type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpType'),
),
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(help_text='Obligatoire et unique, ne doit pas comporter de points', max_length=255, unique=True),
),
migrations.CreateModel(
name='Alias',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('alias', models.CharField(help_text='Obligatoire et unique, ne doit pas comporter de points', max_length=255)),
('interface_parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')),
('extension', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
],
),
migrations.AlterUniqueTogether(
name='alias',
unique_together=set([('alias', 'extension')]),
),
migrations.CreateModel(
name='Mx',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('priority', models.PositiveIntegerField(unique=True)),
('name', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='machines.Alias')),
('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
],
),
migrations.CreateModel(
name='Ns',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
],
),
migrations.AddField(
model_name='extension',
name='origin',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'),
),
migrations.AlterField(
model_name='extension',
name='name',
field=models.CharField(max_length=255, unique=True),
),
migrations.AddField(
model_name='extension',
name='need_infra',
field=models.BooleanField(default=False),
),
migrations.RenameModel(
old_name='Alias',
new_name='Domain',
),
migrations.RenameField(
model_name='domain',
old_name='alias',
new_name='name',
),
migrations.AlterField(
model_name='domain',
name='interface_parent',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Interface'),
),
migrations.AddField(
model_name='domain',
name='cname',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_domain', to='machines.Domain'),
),
migrations.AlterField(
model_name='domain',
name='interface_parent',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.Interface'),
),
migrations.AlterUniqueTogether(
name='domain',
unique_together=set([('name', 'extension')]),
),
migrations.RemoveField(
model_name='interface',
name='dns',
),
migrations.AddField(
model_name='ns',
name='ns',
field=models.OneToOneField(default=1, on_delete=django.db.models.deletion.PROTECT, to='machines.Domain'),
preserve_default=False,
),
migrations.CreateModel(
name='Service',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('service_type', models.CharField(blank=True, max_length=255, unique=True)),
('time_regen', models.DurationField()),
],
),
migrations.CreateModel(
name='Service_link',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_regen', models.DateTimeField(auto_now_add=True)),
('asked_regen', models.BooleanField(default=False)),
('server', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')),
('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Service')),
],
),
migrations.AddField(
model_name='service',
name='servers',
field=models.ManyToManyField(through='machines.Service_link', to='machines.Interface'),
),
migrations.RemoveField(
model_name='service',
name='time_regen',
),
migrations.AddField(
model_name='service',
name='min_time_regen',
field=models.DurationField(default=datetime.timedelta(0, 60), help_text='Temps minimal avant nouvelle génération du service'),
),
migrations.AddField(
model_name='service',
name='regular_time_regen',
field=models.DurationField(default=datetime.timedelta(0, 3600), help_text='Temps maximal avant nouvelle génération du service'),
),
migrations.CreateModel(
name='Vlan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vlan_id', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(4095)])),
('name', models.CharField(max_length=256)),
('comment', models.CharField(blank=True, max_length=256)),
],
),
migrations.AddField(
model_name='iptype',
name='vlan',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.Vlan'),
),
migrations.RenameField(
model_name='iptype',
old_name='domaine_ip',
new_name='domaine_ip_start',
),
migrations.RemoveField(
model_name='iptype',
name='domaine_range',
),
migrations.AddField(
model_name='iptype',
name='domaine_ip_stop',
field=models.GenericIPAddressField(default='255.255.254.254', protocol='IPv4'),
preserve_default=False,
),
migrations.CreateModel(
name='Txt',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('field1', models.CharField(max_length=255)),
('field2', models.TextField(max_length=2047)),
('zone', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
],
),
migrations.CreateModel(
name='Nas',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
('machine_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='machinetype_on_nas', to='machines.MachineType')),
('nas_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='nas_type', to='machines.MachineType')),
('port_access_mode', models.CharField(choices=[('802.1X', '802.1X'), ('Mac-address', 'Mac-address')], default='802.1X', max_length=32)),
('autocapture_mac', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='OuverturePort',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('begin', models.IntegerField()),
('end', models.IntegerField()),
('protocole', models.CharField(choices=[('T', 'TCP'), ('U', 'UDP')], default='T', max_length=1)),
('io', models.CharField(choices=[('I', 'IN'), ('O', 'OUT')], default='O', max_length=1)),
],
),
migrations.CreateModel(
name='OuverturePortList',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Nom de la configuration des ports.', max_length=255)),
],
),
migrations.AddField(
model_name='ouvertureport',
name='port_list',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.OuverturePortList'),
),
migrations.AddField(
model_name='interface',
name='port_lists',
field=models.ManyToManyField(blank=True, to='machines.OuverturePortList'),
),
migrations.AddField(
model_name='iptype',
name='prefix_v6',
field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'),
),
migrations.AddField(
model_name='iptype',
name='ouverture_ports',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.OuverturePortList'),
),
migrations.AlterField(
model_name='ouvertureport',
name='begin',
field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]),
),
migrations.AlterField(
model_name='ouvertureport',
name='end',
field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]),
),
migrations.AddField(
model_name='extension',
name='origin_v6',
field=models.GenericIPAddressField(blank=True, null=True, protocol='IPv6'),
),
migrations.CreateModel(
name='SOA',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('mail', models.EmailField(help_text='Email du contact pour la zone', max_length=254)),
('refresh', models.PositiveIntegerField(default=86400, help_text='Secondes avant que les DNS secondaires doivent demander le serial du DNS primaire pour détecter une modification')),
('retry', models.PositiveIntegerField(default=7200, help_text='Secondes avant que les DNS secondaires fassent une nouvelle demande de serial en cas de timeout du DNS primaire')),
('expire', models.PositiveIntegerField(default=3600000, help_text='Secondes après lesquelles les DNS secondaires arrêtent de de répondre aux requêtes en cas de timeout du DNS primaire')),
('ttl', models.PositiveIntegerField(default=172800, help_text='Time To Live')),
],
),
migrations.AddField(
model_name='extension',
name='soa',
field=models.ForeignKey(default=new_default_soa, on_delete=django.db.models.deletion.CASCADE, to='machines.SOA'),
),
migrations.CreateModel(
name='Srv',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('service', models.CharField(max_length=31)),
('protocole', models.CharField(choices=[('TCP', 'TCP'), ('UDP', 'UDP')], default='TCP', max_length=3)),
('ttl', models.PositiveIntegerField(default=172800, help_text='Time To Live')),
('priority', models.PositiveIntegerField(default=0, help_text="La priorité du serveur cible (valeur entière non négative, plus elle est faible, plus ce serveur sera utilisé s'il est disponible)", validators=[django.core.validators.MaxValueValidator(65535)])),
('weight', models.PositiveIntegerField(default=0, help_text='Poids relatif pour les enregistrements de même priorité (valeur entière de 0 à 65535)', validators=[django.core.validators.MaxValueValidator(65535)])),
('port', models.PositiveIntegerField(help_text='Port (tcp/udp)', validators=[django.core.validators.MaxValueValidator(65535)])),
('extension', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='machines.Extension')),
('target', models.ForeignKey(help_text='Serveur cible', on_delete=django.db.models.deletion.PROTECT, to='machines.Domain')),
],
),
migrations.AlterField(
model_name='extension',
name='name',
field=models.CharField(help_text='Nom de la zone, doit commencer par un point (.example.org)', max_length=255, unique=True),
),
migrations.AlterField(
model_name='extension',
name='origin',
field=models.OneToOneField(blank=True, help_text='Enregistrement A associé à la zone', null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpList'),
),
migrations.AlterField(
model_name='extension',
name='origin_v6',
field=models.GenericIPAddressField(blank=True, help_text='Enregistremen AAAA associé à la zone', null=True, protocol='IPv6'),
),
migrations.AlterField(
model_name='extension',
name='origin_v6',
field=models.GenericIPAddressField(blank=True, help_text='Enregistrement AAAA associé à la zone', null=True, protocol='IPv6'),
),
migrations.AlterModelOptions(
name='domain',
options={'permissions': (('view_domain', 'Peut voir un objet domain'),)},
),
migrations.AlterModelOptions(
name='extension',
options={'permissions': (('view_extension', 'Peut voir un objet extension'), ('use_all_extension', 'Peut utiliser toutes les extension'))},
),
migrations.AlterModelOptions(
name='interface',
options={'permissions': (('view_interface', 'Peut voir un objet interface'), ('change_interface_machine', "Peut changer le propriétaire d'une interface"))},
),
migrations.AlterModelOptions(
name='iplist',
options={'permissions': (('view_iplist', 'Peut voir un objet iplist'),)},
),
migrations.AlterModelOptions(
name='iptype',
options={'permissions': (('view_iptype', 'Peut voir un objet iptype'), ('use_all_iptype', 'Peut utiliser tous les iptype'))},
),
migrations.AlterModelOptions(
name='machine',
options={'permissions': (('view_machine', 'Peut voir un objet machine quelquonque'), ('change_machine_user', "Peut changer le propriétaire d'une machine"))},
),
migrations.AlterModelOptions(
name='machinetype',
options={'permissions': (('view_machinetype', 'Peut voir un objet machinetype'), ('use_all_machinetype', "Peut utiliser n'importe quel type de machine"))},
),
migrations.AlterModelOptions(
name='mx',
options={'permissions': (('view_mx', 'Peut voir un objet mx'),)},
),
migrations.AlterModelOptions(
name='nas',
options={'permissions': (('view_nas', 'Peut voir un objet Nas'),)},
),
migrations.AlterModelOptions(
name='ns',
options={'permissions': (('view_ns', 'Peut voir un objet ns'),)},
),
migrations.AlterModelOptions(
name='ouvertureportlist',
options={'permissions': (('view_ouvertureportlist', 'Peut voir un objet ouvertureport'),)},
),
migrations.AlterModelOptions(
name='service',
options={'permissions': (('view_service', 'Peut voir un objet service'),)},
),
migrations.AlterModelOptions(
name='soa',
options={'permissions': (('view_soa', 'Peut voir un objet soa'),)},
),
migrations.AlterModelOptions(
name='srv',
options={'permissions': (('view_soa', 'Peut voir un objet soa'),)},
),
migrations.AlterModelOptions(
name='txt',
options={'permissions': (('view_txt', 'Peut voir un objet txt'),)},
),
migrations.AlterModelOptions(
name='vlan',
options={'permissions': (('view_vlan', 'Peut voir un objet vlan'),)},
),
migrations.CreateModel(
name='Ipv6List',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ipv6', models.GenericIPAddressField(protocol='IPv6', unique=True)),
('slaac_ip', models.BooleanField(default=False)),
('interface', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='machines.Interface')),
],
),
migrations.AlterUniqueTogether(
name='ipv6list',
unique_together=set([('interface', 'slaac_ip')]),
),
migrations.AlterModelOptions(
name='ipv6list',
options={'permissions': (('view_ipv6list', 'Peut voir un objet ipv6'), ('change_ipv6list_slaac_ip', 'Peut changer la valeur slaac sur une ipv6'))},
),
migrations.AlterUniqueTogether(
name='ipv6list',
unique_together=set([]),
),
migrations.AlterField(
model_name='ipv6list',
name='interface',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ipv6list', to='machines.Interface'),
),
]

View file

@ -0,0 +1,198 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-20 19:57
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import preferences.aes_field
class Migration(migrations.Migration):
replaces = [('preferences', '0001_initial'), ('preferences', '0002_auto_20170625_1923'), ('preferences', '0003_optionaluser_solde_negatif'), ('preferences', '0004_assooption_services'), ('preferences', '0005_auto_20170824_0139'), ('preferences', '0006_auto_20170824_0143'), ('preferences', '0007_auto_20170824_2056'), ('preferences', '0008_auto_20170824_2122'), ('preferences', '0009_assooption_utilisateur_asso'), ('preferences', '0010_auto_20170825_0459'), ('preferences', '0011_auto_20170825_2307'), ('preferences', '0012_generaloption_req_expire_hrs'), ('preferences', '0013_generaloption_site_name'), ('preferences', '0014_generaloption_email_from'), ('preferences', '0015_optionaltopologie_radius_general_policy'), ('preferences', '0016_auto_20170902_1520'), ('preferences', '0017_mailmessageoption'), ('preferences', '0018_optionaltopologie_mac_autocapture'), ('preferences', '0019_remove_optionaltopologie_mac_autocapture'), ('preferences', '0020_optionalmachine_ipv6'), ('preferences', '0021_auto_20171015_1741'), ('preferences', '0022_auto_20171015_1758'), ('preferences', '0023_auto_20171015_2033'), ('preferences', '0024_optionaluser_all_can_create'), ('preferences', '0025_generaloption_general_message'), ('preferences', '0026_auto_20171216_0401'), ('preferences', '0025_auto_20171231_2142'), ('preferences', '0027_merge_20180106_2019'), ('preferences', '0028_auto_20180111_1129'), ('preferences', '0029_auto_20180111_1134'), ('preferences', '0030_auto_20180111_2346'), ('preferences', '0031_optionaluser_self_adhesion'), ('preferences', '0032_optionaluser_min_online_payment'), ('preferences', '0033_generaloption_gtu_sum_up'), ('preferences', '0034_auto_20180114_2025'), ('preferences', '0035_auto_20180114_2132'), ('preferences', '0036_auto_20180114_2141'), ('preferences', '0037_auto_20180114_2156'), ('preferences', '0038_auto_20180114_2209'), ('preferences', '0039_auto_20180115_0003'), ('preferences', '0040_auto_20180129_1745'), ('preferences', '0028_auto_20180128_2203'), ('preferences', '0041_merge_20180130_0052'), ('preferences', '0042_auto_20180222_1743'), ('preferences', '0043_optionalmachine_create_machine'), ('preferences', '0028_assooption_description'), ('preferences', '0029_auto_20180318_1005'), ('preferences', '0029_auto_20180318_0213'), ('preferences', '0030_merge_20180320_1419')]
initial = True
dependencies = [
# migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='GeneralOption',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('search_display_page', models.IntegerField(default=15)),
('pagination_large_number', models.IntegerField(default=8)),
('pagination_number', models.IntegerField(default=25)),
('req_expire_hrs', models.IntegerField(default=48)),
('site_name', models.CharField(default='Re2o', max_length=32)),
('email_from', models.EmailField(default='www-data@serveur.net', max_length=254)),
('general_message', models.TextField(blank=True, default='', help_text='Message général affiché sur le site (maintenance, etc')),
],
),
migrations.CreateModel(
name='OptionalMachine',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password_machine', models.BooleanField(default=False)),
('max_lambdauser_interfaces', models.IntegerField(default=10)),
('max_lambdauser_aliases', models.IntegerField(default=10)),
('ipv6', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='OptionalUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('is_tel_mandatory', models.BooleanField(default=True)),
('user_solde', models.BooleanField(default=False)),
('gpg_fingerprint', models.BooleanField(default=True)),
('solde_negatif', models.DecimalField(decimal_places=2, default=0, max_digits=5)),
('all_can_create', models.BooleanField(default=False, help_text="Tous les users peuvent en créer d'autres")),
],
),
migrations.CreateModel(
name='AssoOption',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='Association réseau école machin', max_length=256)),
('siret', models.CharField(default='00000000000000', max_length=32)),
('contact', models.EmailField(default='contact@example.org', max_length=254)),
('telephone', models.CharField(default='0000000000', max_length=15)),
('pseudo', models.CharField(default='Asso', max_length=32)),
('adresse1', models.CharField(default='1 Rue de exemple', max_length=128)),
('adresse2', models.CharField(default='94230 Cachan', max_length=128)),
('utilisateur_asso', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Service',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=32)),
('url', models.URLField()),
('description', models.TextField()),
('image', models.ImageField(blank=True, upload_to='logo')),
],
),
migrations.CreateModel(
name='OptionalTopologie',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vlan_decision_nok', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='decision_nok', to='machines.Vlan')),
('vlan_decision_ok', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='decision_ok', to='machines.Vlan')),
('radius_general_policy', models.CharField(choices=[('MACHINE', 'Sur le vlan de la plage ip machine'), ('DEFINED', 'Prédéfini dans "Vlan où placer les machines après acceptation RADIUS"')], default='DEFINED', max_length=32)),
],
),
migrations.CreateModel(
name='MailMessageOption',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('welcome_mail_fr', models.TextField(default='')),
('welcome_mail_en', models.TextField(default='')),
],
),
migrations.AlterModelOptions(
name='assooption',
options={'permissions': (('view_assooption', "Peut voir les options de l'asso"),)},
),
migrations.AlterModelOptions(
name='generaloption',
options={'permissions': (('view_generaloption', 'Peut voir les options générales'),)},
),
migrations.AlterModelOptions(
name='mailmessageoption',
options={'permissions': (('view_mailmessageoption', 'Peut voir les options de mail'),)},
),
migrations.AlterModelOptions(
name='optionalmachine',
options={'permissions': (('view_optionalmachine', 'Peut voir les options de machine'),)},
),
migrations.AlterModelOptions(
name='optionaltopologie',
options={'permissions': (('view_optionaltopologie', 'Peut voir les options de topologie'),)},
),
migrations.AlterModelOptions(
name='optionaluser',
options={'permissions': (('view_optionaluser', "Peut voir les options de l'user"),)},
),
migrations.AlterModelOptions(
name='service',
options={'permissions': (('view_service', 'Peut voir les options de service'),)},
),
migrations.AddField(
model_name='assooption',
name='payment',
field=models.CharField(choices=[('NONE', 'NONE'), ('COMNPAY', 'COMNPAY')], default='NONE', max_length=255),
),
migrations.AddField(
model_name='optionaluser',
name='max_solde',
field=models.DecimalField(decimal_places=2, default=50, max_digits=5),
),
migrations.AddField(
model_name='optionaluser',
name='self_adhesion',
field=models.BooleanField(default=False, help_text='Un nouvel utilisateur peut se créer son compte sur re2o'),
),
migrations.AddField(
model_name='optionaluser',
name='min_online_payment',
field=models.DecimalField(decimal_places=2, default=10, max_digits=5),
),
migrations.AddField(
model_name='generaloption',
name='GTU_sum_up',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='generaloption',
name='GTU',
field=models.FileField(blank=True, default='', null=True, upload_to=''),
),
migrations.AddField(
model_name='assooption',
name='payment_id',
field=models.CharField(blank=True, default='', max_length=255),
),
migrations.AddField(
model_name='assooption',
name='payment_pass',
field=preferences.aes_field.AESEncryptedField(blank=True, max_length=255, null=True),
),
migrations.RemoveField(
model_name='optionalmachine',
name='ipv6',
),
migrations.AddField(
model_name='optionalmachine',
name='ipv6_mode',
field=models.CharField(choices=[('SLAAC', 'Autoconfiguration par RA'), ('DHCPV6', 'Attribution des ip par dhcpv6'), ('DISABLED', 'Désactivé')], default='DISABLED', max_length=32),
),
migrations.RemoveField(
model_name='optionaluser',
name='all_can_create',
),
migrations.AddField(
model_name='optionaluser',
name='all_can_create_adherent',
field=models.BooleanField(default=False, help_text="Les users peuvent créer d'autres adhérents"),
),
migrations.AddField(
model_name='optionaluser',
name='all_can_create_club',
field=models.BooleanField(default=False, help_text='Les users peuvent créer un club'),
),
migrations.AddField(
model_name='optionalmachine',
name='create_machine',
field=models.BooleanField(default=True, help_text="Permet à l'user de créer une machine"),
),
migrations.AddField(
model_name='assooption',
name='description',
field=models.TextField(blank=True, null=True),
),
]

View file

@ -0,0 +1,220 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-20 19:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('topologie', '0001_initial'), ('topologie', '0002_auto_20160703_1118'), ('topologie', '0003_room'), ('topologie', '0004_auto_20160703_1122'), ('topologie', '0005_auto_20160703_1123'), ('topologie', '0006_auto_20160703_1129'), ('topologie', '0007_auto_20160703_1148'), ('topologie', '0008_port_room'), ('topologie', '0009_auto_20160703_1200'), ('topologie', '0010_auto_20160704_2148'), ('topologie', '0011_auto_20160704_2153'), ('topologie', '0012_port_machine_interface'), ('topologie', '0013_port_related'), ('topologie', '0014_auto_20160706_1238'), ('topologie', '0015_auto_20160706_1452'), ('topologie', '0016_auto_20160706_1531'), ('topologie', '0017_auto_20160718_1141'), ('topologie', '0018_room_details'), ('topologie', '0019_auto_20161026_1348'), ('topologie', '0020_auto_20161119_0033'), ('topologie', '0021_port_radius'), ('topologie', '0022_auto_20161211_1622'), ('topologie', '0023_auto_20170826_1530'), ('topologie', '0024_auto_20170826_1800'), ('topologie', '0023_auto_20170817_1654'), ('topologie', '0024_auto_20170818_1021'), ('topologie', '0025_merge_20170902_1242'), ('topologie', '0026_auto_20170902_1245'), ('topologie', '0027_auto_20170905_1442'), ('topologie', '0028_auto_20170913_1503'), ('topologie', '0029_auto_20171002_0334'), ('topologie', '0030_auto_20171004_0235'), ('topologie', '0031_auto_20171015_2033'), ('topologie', '0032_auto_20171026_0338'), ('topologie', '0033_auto_20171231_1743')]
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Switch',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('building', models.CharField(max_length=10)),
('number', models.IntegerField()),
('details', models.CharField(blank=True, max_length=255)),
],
),
migrations.CreateModel(
name='Port',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('port', models.IntegerField()),
('details', models.CharField(blank=True, max_length=255)),
('switch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ports', to='topologie.Switch')),
('room', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='topologie.Room')),
('machine_interface', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='machines.Interface')),
('related', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_port', to='topologie.Port')),
('radius', models.CharField(choices=[('NO', 'NO'), ('STRICT', 'STRICT'), ('BLOQ', 'BLOQ'), ('COMMON', 'COMMON')], default='NO', max_length=32)),
('vlan_force', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='machines.Vlan')),
],
),
migrations.AlterUniqueTogether(
name='port',
unique_together=set([('switch', 'port')]),
),
migrations.CreateModel(
name='Room',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('details', models.CharField(blank=True, max_length=255)),
('building', models.CharField(max_length=255, unique=True)),
('number', models.IntegerField()),
('room', models.IntegerField(default=1)),
],
),
migrations.AddField(
model_name='switch',
name='location',
field=models.CharField(default='test', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='switch',
name='switch_interface',
field=models.OneToOneField(default=1, on_delete=django.db.models.deletion.CASCADE, to='machines.Interface'),
preserve_default=False,
),
migrations.AlterUniqueTogether(
name='switch',
unique_together=set([]),
),
migrations.AlterUniqueTogether(
name='room',
unique_together=set([('building', 'number')]),
),
migrations.AlterField(
model_name='room',
name='building',
field=models.CharField(max_length=255),
),
migrations.AlterField(
model_name='room',
name='number',
field=models.IntegerField(blank=True),
),
migrations.AlterUniqueTogether(
name='room',
unique_together=set([('building', 'room', 'number')]),
),
migrations.AlterField(
model_name='room',
name='number',
field=models.IntegerField(blank=True, null=True),
),
migrations.RenameField(
model_name='room',
old_name='building',
new_name='name',
),
migrations.AlterUniqueTogether(
name='room',
unique_together=set([]),
),
migrations.RemoveField(
model_name='room',
name='details',
),
migrations.RemoveField(
model_name='room',
name='number',
),
migrations.RemoveField(
model_name='room',
name='room',
),
migrations.AlterField(
model_name='room',
name='name',
field=models.CharField(max_length=255, unique=True),
),
migrations.AddField(
model_name='room',
name='details',
field=models.CharField(blank=True, max_length=255),
),
migrations.RemoveField(
model_name='switch',
name='building',
),
migrations.CreateModel(
name='Stack',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=32, null=True)),
('stack_id', models.CharField(max_length=32, unique=True)),
('details', models.CharField(blank=True, max_length=255, null=True)),
('member_id_min', models.PositiveIntegerField()),
('member_id_max', models.PositiveIntegerField()),
],
),
migrations.AddField(
model_name='switch',
name='stack_member_id',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='switch',
name='stack',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='topologie.Stack'),
),
migrations.AlterUniqueTogether(
name='switch',
unique_together=set([('stack', 'stack_member_id')]),
),
migrations.AlterField(
model_name='switch',
name='stack',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='topologie.Stack'),
),
migrations.AlterModelOptions(
name='room',
options={'ordering': ['name'], 'permissions': (('view_room', 'Peut voir un objet chambre'),)},
),
migrations.AlterField(
model_name='port',
name='port',
field=models.PositiveIntegerField(),
),
migrations.AlterField(
model_name='switch',
name='number',
field=models.PositiveIntegerField(),
),
migrations.AlterField(
model_name='switch',
name='stack_member_id',
field=models.PositiveIntegerField(blank=True, null=True),
),
migrations.CreateModel(
name='ConstructorSwitch',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='ModelSwitch',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('reference', models.CharField(max_length=255)),
('constructor', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='topologie.ConstructorSwitch')),
],
),
migrations.AddField(
model_name='switch',
name='model',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='topologie.ModelSwitch'),
),
migrations.AlterModelOptions(
name='constructorswitch',
options={'permissions': (('view_constructorswitch', 'Peut voir un objet constructorswitch'),)},
),
migrations.AlterModelOptions(
name='modelswitch',
options={'permissions': (('view_modelswitch', 'Peut voir un objet modelswitch'),)},
),
migrations.AlterModelOptions(
name='port',
options={'permissions': (('view_port', 'Peut voir un objet port'),)},
),
migrations.AlterModelOptions(
name='stack',
options={'permissions': (('view_stack', 'Peut voir un objet stack'),)},
),
migrations.AlterModelOptions(
name='switch',
options={'permissions': (('view_switch', 'Peut voir un objet switch'),)},
),
]

View file

@ -0,0 +1,929 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-03-21 17:52
from __future__ import unicode_literals
import datetime
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.migrations.operations.special
import django.db.models.deletion
from django.utils.timezone import utc
import ldapdb.models.fields
import users.models
# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:
# users.migrations.0017_auto_20160707_0105
def move_passwords(apps, schema_editor):
User = apps.get_model('users', 'User')
for row in User.objects.all():
row.password = row.pwd_ssha
row.save()
# users.migrations.0058_auto_20171025_0154
def create_move_room(apps, schema_editor):
User = apps.get_model('users', 'User')
Adherent = apps.get_model('users', 'Adherent')
Club = apps.get_model('users', 'Club')
db_alias = schema_editor.connection.alias
users = Adherent.objects.using(db_alias).all()
clubs = Club.objects.using(db_alias).all()
for user in users:
user.room_adherent_id = user.room_id
user.save(using=db_alias)
for user in clubs:
user.room_club_id = user.room_id
user.save(using=db_alias)
def delete_move_room(apps, schema_editor):
User = apps.get_model('users', 'User')
Adherent = apps.get_model('users', 'Adherent')
Club = apps.get_model('users', 'Club')
db_alias = schema_editor.connection.alias
users = Adherent.objects.using(db_alias).all()
clubs = Club.objects.using(db_alias).all()
for user in users:
user.room_id = user.room_adherent_id
user.save(using=db_alias)
for user in clubs:
user.room_id = user.room_club_id
user.save(using=db_alias)
# users.migrations.0062_auto_20171231_0056
def create_groups(apps, schema_editor):
group = apps.get_model("auth", "Group")
listrights = apps.get_model("users", "ListRight")
db_alias = schema_editor.connection.alias
for gr in listrights.objects.using(db_alias).all():
grp = group()
grp.name=gr.unix_name
grp.save()
gr.group_ptr=grp
gr.save()
def delete_groups(apps, schema_editor):
group = apps.get_model("auth", "Group")
db_alias = schema_editor.connection.alias
group.objects.using(db_alias).all().delete()
# users.migrations.0063_auto_20171231_0140
def transfer_right(apps, schema_editor):
rights = apps.get_model("users", "Right")
db_alias = schema_editor.connection.alias
for rg in rights.objects.using(db_alias).all():
group = rg.right
u=rg.user
u.groups.add(group.group_ptr)
u.save()
def untransfer_right(apps, schema_editor):
return
# users.migrations.0066_grouppermissions
def transfer_permissions_0066(apps, schema_editor):
permission_groups = {'bofh': ['add_ban',
'change_ban',
'delete_ban',
'view_ban',
'add_club',
'change_club',
'delete_club',
'add_user',
'change_user',
'change_user_force',
'change_user_password',
'change_user_shell',
'view_user',
'add_whitelist',
'change_whitelist',
'delete_whitelist',
'view_whitelist'],
'bureau': ['add_logentry',
'change_logentry',
'delete_logentry',
'add_group',
'change_group',
'delete_group',
'add_permission',
'change_permission',
'delete_permission',
'add_adherent',
'change_adherent',
'delete_adherent',
'add_ban',
'change_ban',
'delete_ban',
'view_ban',
'add_club',
'change_club',
'delete_club',
'add_listright',
'change_listright',
'delete_listright',
'view_listright',
'add_school',
'change_school',
'delete_school',
'view_school',
'add_user',
'change_user',
'change_user_force',
'change_user_groups',
'change_user_password',
'change_user_shell',
'change_user_state',
'delete_user',
'view_user',
'add_whitelist',
'change_whitelist',
'delete_whitelist',
'view_whitelist'],
'cableur': ['add_logentry',
'view_article',
'add_banque',
'change_banque',
'delete_banque',
'view_banque',
'add_cotisation',
'change_cotisation',
'delete_cotisation',
'view_cotisation',
'add_facture',
'can_create',
'can_delete',
'can_edit',
'can_view',
'can_view_all',
'change_facture',
'delete_facture',
'view_facture',
'view_paiement',
'add_vente',
'change_vente',
'delete_vente',
'view_vente',
'add_domain',
'change_domain',
'delete_domain',
'view_domain',
'use_all_extension',
'view_extension',
'add_interface',
'change_interface',
'delete_interface',
'view_interface',
'view_iplist',
'view_iptype',
'add_machine',
'change_machine',
'view_machine',
'view_machinetype',
'view_mx',
'view_nas',
'view_ns',
'view_ouvertureportlist',
'view_service',
'view_soa',
'view_soa',
'view_txt',
'view_vlan',
'view_assooption',
'view_generaloption',
'view_mailmessageoption',
'view_optionalmachine',
'view_optionaltopologie',
'view_optionaluser',
'view_service',
'view_constructorswitch',
'view_modelswitch',
'view_port',
'view_room',
'view_stack',
'view_switch',
'add_adherent',
'change_adherent',
'view_ban',
'add_club',
'change_club',
'view_listright',
'add_school',
'change_school',
'delete_school',
'view_school',
'view_serviceuser',
'add_user',
'change_user',
'change_user_force',
'change_user_password',
'view_user',
'add_whitelist',
'change_whitelist',
'delete_whitelist',
'view_whitelist'],
'tresorier': ['add_article',
'change_article',
'delete_article',
'view_article',
'add_banque',
'change_banque',
'delete_banque',
'view_banque',
'add_cotisation',
'change_all_cotisation',
'change_cotisation',
'delete_cotisation',
'view_cotisation',
'add_facture',
'can_change_control',
'can_change_pdf',
'can_create',
'can_delete',
'can_edit',
'can_view',
'can_view_all',
'change_all_facture',
'change_facture',
'change_facture_control',
'change_facture_pdf',
'delete_facture',
'view_facture',
'add_paiement',
'change_paiement',
'delete_paiement',
'view_paiement',
'add_vente',
'change_all_vente',
'change_vente',
'delete_vente',
'view_vente'],
'admin': ['add_logentry',
'change_logentry',
'delete_logentry',
'add_assooption',
'change_assooption',
'delete_assooption',
'view_assooption',
'add_generaloption',
'change_generaloption',
'delete_generaloption',
'view_generaloption',
'add_mailmessageoption',
'change_mailmessageoption',
'delete_mailmessageoption',
'view_mailmessageoption',
'add_optionalmachine',
'change_optionalmachine',
'delete_optionalmachine',
'view_optionalmachine',
'add_optionaltopologie',
'change_optionaltopologie',
'delete_optionaltopologie',
'view_optionaltopologie',
'add_optionaluser',
'change_optionaluser',
'delete_optionaluser',
'view_optionaluser',
'add_service',
'add_services',
'change_service',
'change_services',
'delete_service',
'delete_services',
'view_service'],
'infra': ['add_domain',
'change_domain',
'delete_domain',
'view_domain',
'add_extension',
'change_extension',
'delete_extension',
'use_all_extension',
'view_extension',
'add_interface',
'change_interface',
'delete_interface',
'view_interface',
'add_iplist',
'change_iplist',
'delete_iplist',
'view_iplist',
'add_iptype',
'change_iptype',
'delete_iptype',
'use_all_iptype',
'view_iptype',
'add_machine',
'change_machine',
'change_machine_user',
'delete_machine',
'view_machine',
'add_machinetype',
'change_machinetype',
'delete_machinetype',
'use_all_machinetype',
'view_machinetype',
'add_mx',
'change_mx',
'delete_mx',
'view_mx',
'add_nas',
'change_nas',
'delete_nas',
'view_nas',
'add_ns',
'change_ns',
'delete_ns',
'view_ns',
'add_ouvertureport',
'change_ouvertureport',
'delete_ouvertureport',
'add_ouvertureportlist',
'change_ouvertureportlist',
'delete_ouvertureportlist',
'view_ouvertureportlist',
'add_service',
'change_service',
'delete_service',
'view_service',
'add_service_link',
'change_service_link',
'delete_service_link',
'add_soa',
'change_soa',
'delete_soa',
'view_soa',
'add_srv',
'change_srv',
'delete_srv',
'view_soa',
'add_text',
'add_txt',
'change_text',
'change_txt',
'delete_text',
'delete_txt',
'view_txt',
'add_vlan',
'change_vlan',
'delete_vlan',
'view_vlan',
'add_constructorswitch',
'change_constructorswitch',
'delete_constructorswitch',
'view_constructorswitch',
'add_modelswitch',
'change_modelswitch',
'delete_modelswitch',
'view_modelswitch',
'add_port',
'change_port',
'delete_port',
'view_port',
'add_room',
'change_room',
'delete_room',
'view_room',
'add_stack',
'change_stack',
'delete_stack',
'view_stack',
'add_switch',
'change_switch',
'delete_switch',
'view_switch',
'add_listshell',
'change_listshell',
'delete_listshell',
'add_serviceuser',
'change_serviceuser',
'delete_serviceuser',
'view_serviceuser',
'change_user',
'view_user']}
rights = apps.get_model("users", "ListRight")
permissions = apps.get_model("auth", "Permission")
groups = apps.get_model("auth", "Group")
db_alias = schema_editor.connection.alias
for group in permission_groups:
lr_object = rights.objects.using(db_alias).filter(unix_name=group).first()
if not lr_object:
last = rights.objects.using(db_alias).all().order_by('gid').last()
if last:
gid = last.gid + 1
else:
gid = 501
group_object = groups.objects.using(db_alias).create(name=group)
lr_object = rights.objects.using(db_alias).create(unix_name=group, gid=gid, group_ptr=group_object)
lr_object = lr_object.group_ptr
for permission in permission_groups[group]:
perm = permissions.objects.using(db_alias).filter(codename=permission).first()
if perm:
lr_object.permissions.add(perm)
lr_object.save()
def untransfer_permissions_0066(apps, schema_editor):
return
# Users.migrations.0067_serveurpermission
def transfer_permissions_0067(apps, schema_editor):
db_alias = schema_editor.connection.alias
contenttype = apps.get_model("contenttypes", "ContentType")
rights = apps.get_model("users", "ListRight")
permissions = apps.get_model("auth", "Permission")
groups = apps.get_model("auth", "Group")
machine = apps.get_model("machines", "Machine")
perm = permissions.objects.using(db_alias).filter(codename='serveur').first()
if not perm:
perm = permissions.objects.using(db_alias).create(
codename='serveur',
name='Serveur',
content_type=contenttype.objects.get_for_model(machine)
)
group_object = rights.objects.using(db_alias).filter(unix_name='serveur').first()
if not group_object:
last_gid = rights.objects.using(db_alias).all().order_by('gid').last().gid
gid = last_gid + 1
abstract_group = groups.objects.using(db_alias).create(name='serveur')
group_object = rights.objects.using(db_alias).create(group_ptr=abstract_group, unix_name='serveur', gid=gid)
group_object = group_object.group_ptr
group_object.permissions.add(perm)
group_object.save()
def untransfer_permissions_0067(apps, schema_editor):
return
# users.migrations.0068_auto_20180107_2245
def transfer_permissions_0068(apps, schema_editor):
critical_rights = ['adm', 'admin', 'bureau', 'infra', 'tresorier', 'serveur', 'bofh']
db_alias = schema_editor.connection.alias
rights = apps.get_model("users", "ListRight")
for right in critical_rights:
rg = rights.objects.using(db_alias).filter(unix_name=right).first()
if rg:
rg.critical=True
rg.save()
def untransfer_permissions_0068(apps, schema_editor):
return
class Migration(migrations.Migration):
replaces = [('users', '0001_initial'), ('users', '0002_auto_20160630_2301'), ('users', '0003_listrights_rights'), ('users', '0004_auto_20160701_2312'), ('users', '0005_auto_20160702_0006'), ('users', '0006_ban'), ('users', '0007_auto_20160702_2322'), ('users', '0008_user_registered'), ('users', '0009_user_room'), ('users', '0010_auto_20160703_1226'), ('users', '0011_auto_20160703_1227'), ('users', '0012_auto_20160703_1230'), ('users', '0013_auto_20160704_1547'), ('users', '0014_auto_20160704_1548'), ('users', '0015_whitelist'), ('users', '0016_auto_20160706_1220'), ('users', '0017_auto_20160707_0105'), ('users', '0018_auto_20160707_0115'), ('users', '0019_auto_20160708_1633'), ('users', '0020_request'), ('users', '0021_ldapuser'), ('users', '0022_ldapuser_sambasid'), ('users', '0023_auto_20160724_1908'), ('users', '0024_remove_ldapuser_mac_list'), ('users', '0025_listshell'), ('users', '0026_user_shell'), ('users', '0027_auto_20160726_0216'), ('users', '0028_auto_20160726_0227'), ('users', '0029_auto_20160726_0229'), ('users', '0030_auto_20160726_0357'), ('users', '0031_auto_20160726_0359'), ('users', '0032_auto_20160727_2122'), ('users', '0033_remove_ldapuser_loginshell'), ('users', '0034_auto_20161018_0037'), ('users', '0035_auto_20161018_0046'), ('users', '0036_auto_20161022_2146'), ('users', '0037_auto_20161028_1906'), ('users', '0038_auto_20161031_0258'), ('users', '0039_auto_20161119_0033'), ('users', '0040_auto_20161119_1709'), ('users', '0041_listright_details'), ('users', '0042_auto_20161126_2028'), ('users', '0043_auto_20161224_1156'), ('users', '0044_user_ssh_public_key'), ('users', '0043_ban_state'), ('users', '0045_merge'), ('users', '0046_auto_20170617_1433'), ('users', '0047_auto_20170618_0156'), ('users', '0048_auto_20170618_0210'), ('users', '0049_auto_20170618_1424'), ('users', '0050_serviceuser_comment'), ('users', '0051_user_telephone'), ('users', '0052_ldapuser_shadowexpire'), ('users', '0053_auto_20170626_2105'), ('users', '0054_auto_20170626_2219'), ('users', '0055_auto_20171003_0556'), ('users', '0056_auto_20171015_2033'), ('users', '0057_auto_20171023_0301'), ('users', '0058_auto_20171025_0154'), ('users', '0059_auto_20171025_1854'), ('users', '0060_auto_20171120_0317'), ('users', '0061_auto_20171230_2033'), ('users', '0062_auto_20171231_0056'), ('users', '0063_auto_20171231_0140'), ('users', '0064_auto_20171231_0150'), ('users', '0065_auto_20171231_2053'), ('users', '0066_grouppermissions'), ('users', '0067_serveurpermission'), ('users', '0068_auto_20180107_2245'), ('users', '0069_club_mailing')]
initial = True
dependencies = [
# ('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.CreateModel(
name='School',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('surname', models.CharField(max_length=255)),
('pseudo', models.CharField(max_length=255, unique=True)),
('email', models.EmailField(max_length=254)),
('promo', models.CharField(max_length=255)),
('pwd_ssha', models.CharField(max_length=255)),
('pwd_ntlm', models.CharField(max_length=255)),
('state', models.IntegerField(choices=[(0, 'STATE_ACTIVE'), (1, 'STATE_DEACTIVATED'), (2, 'STATE_ARCHIVED')], default=0)),
('school', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.School')),
],
),
migrations.CreateModel(
name='ListRights',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('listright', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Right',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('right', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='users.ListRights')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.RenameModel(
old_name='ListRights',
new_name='ListRight',
),
migrations.AlterUniqueTogether(
name='right',
unique_together=set([('user', 'right')]),
),
migrations.CreateModel(
name='Ban',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('raison', models.CharField(max_length=255)),
('date_start', models.DateTimeField(auto_now_add=True)),
('date_end', models.DateTimeField(help_text='%d/%m/%y %H:%M:%S')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='user',
name='registered',
field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2016, 7, 2, 23, 25, 21, 698883, tzinfo=utc)),
preserve_default=False,
),
migrations.AddField(
model_name='user',
name='room',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='topologie.Room'),
),
migrations.AddField(
model_name='user',
name='comment',
field=models.CharField(blank=True, help_text='Commentaire, promo', max_length=255),
),
migrations.RemoveField(
model_name='user',
name='promo',
),
migrations.CreateModel(
name='Whitelist',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('raison', models.CharField(max_length=255)),
('date_start', models.DateTimeField(auto_now_add=True)),
('date_end', models.DateTimeField(help_text='%d/%m/%y %H:%M:%S')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AlterField(
model_name='user',
name='pseudo',
field=models.CharField(help_text='Doit contenir uniquement des lettres, chiffres, ou tirets', max_length=32, unique=True, validators=[users.models.linux_user_validator]),
),
migrations.AddField(
model_name='user',
name='last_login',
field=models.DateTimeField(blank=True, null=True, verbose_name='last login'),
),
migrations.AddField(
model_name='user',
name='password',
field=models.CharField(default='!', max_length=128, verbose_name='password'),
preserve_default=False,
),
migrations.RunPython(
code=move_passwords,
reverse_code=django.db.migrations.operations.special.RunPython.noop,
),
migrations.RemoveField(
model_name='user',
name='pwd_ssha',
),
migrations.AlterField(
model_name='listright',
name='listright',
field=models.CharField(max_length=255, unique=True),
),
migrations.CreateModel(
name='Request',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(choices=[('PW', 'Mot de passe'), ('EM', 'Email')], max_length=2)),
('token', models.CharField(max_length=32)),
('created_at', models.DateTimeField(auto_now_add=True)),
('expires_at', models.DateTimeField()),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='LdapUser',
fields=[
('dn', models.CharField(max_length=200, primary_key=True, serialize=False)),
('gid', ldapdb.models.fields.IntegerField(db_column='gidNumber')),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200, primary_key=True, serialize=False)),
('uid', ldapdb.models.fields.CharField(db_column='uid', max_length=200)),
('uidNumber', ldapdb.models.fields.IntegerField(db_column='uidNumber', unique=True)),
('sn', ldapdb.models.fields.CharField(db_column='sn', max_length=200)),
('mail', ldapdb.models.fields.CharField(db_column='mail', max_length=200)),
('given_name', ldapdb.models.fields.CharField(db_column='givenName', max_length=200)),
('home_directory', ldapdb.models.fields.CharField(db_column='homeDirectory', max_length=200)),
('dialupAccess', ldapdb.models.fields.CharField(db_column='dialupAccess', max_length=200)),
('sambaSID', ldapdb.models.fields.IntegerField(db_column='sambaSID', unique=True)),
('display_name', ldapdb.models.fields.CharField(blank=True, db_column='displayName', max_length=200, null=True)),
('macs', ldapdb.models.fields.ListField(blank=True, db_column='radiusCallingStationId', max_length=200, null=True)),
('sambat_nt_password', ldapdb.models.fields.CharField(blank=True, db_column='sambaNTPassword', max_length=200, null=True)),
('user_password', ldapdb.models.fields.CharField(blank=True, db_column='userPassword', max_length=200, null=True)),
('login_shell', ldapdb.models.fields.CharField(blank=True, db_column='loginShell', max_length=200, null=True)),
('shadowexpire', ldapdb.models.fields.CharField(blank=True, db_column='shadowExpire', max_length=200, null=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ListShell',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('shell', models.CharField(max_length=255, unique=True)),
],
),
migrations.AddField(
model_name='user',
name='shell',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.ListShell'),
),
migrations.CreateModel(
name='LdapUserGroup',
fields=[
('dn', models.CharField(max_length=200, primary_key=True, serialize=False)),
('gid', ldapdb.models.fields.IntegerField(db_column='gidNumber')),
('members', ldapdb.models.fields.ListField(blank=True, db_column='memberUid')),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200, primary_key=True, serialize=False)),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='listright',
name='gid',
field=models.PositiveIntegerField(null=True, unique=True),
),
migrations.CreateModel(
name='LdapServiceUser',
fields=[
('dn', models.CharField(max_length=200, primary_key=True, serialize=False)),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200, primary_key=True, serialize=False)),
('user_password', ldapdb.models.fields.CharField(blank=True, db_column='userPassword', max_length=200, null=True)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ServiceUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('pseudo', models.CharField(help_text='Doit contenir uniquement des lettres, chiffres, ou tirets', max_length=32, unique=True, validators=[users.models.linux_user_validator])),
('access_group', models.CharField(choices=[('auth', 'auth'), ('readonly', 'readonly'), ('usermgmt', 'usermgmt')], default='readonly', max_length=32)),
('comment', models.CharField(blank=True, help_text='Commentaire', max_length=255)),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='user',
name='rezo_rez_uid',
field=models.PositiveIntegerField(blank=True, null=True, unique=True),
),
migrations.AddField(
model_name='user',
name='uid_number',
field=models.PositiveIntegerField(default=users.models.User.auto_uid, unique=True),
),
migrations.AlterField(
model_name='user',
name='school',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.School'),
),
migrations.AlterField(
model_name='user',
name='state',
field=models.IntegerField(choices=[(0, 'STATE_ACTIVE'), (1, 'STATE_DISABLED'), (2, 'STATE_ARCHIVE')], default=0),
),
migrations.AddField(
model_name='listright',
name='details',
field=models.CharField(blank=True, help_text='Description', max_length=255),
),
migrations.AddField(
model_name='ban',
name='state',
field=models.IntegerField(choices=[(0, 'HARD (aucun accès)'), (1, 'SOFT (accès local seulement)'), (2, 'BRIDAGE (bridage du débit)')], default=0),
),
migrations.CreateModel(
name='LdapServiceUserGroup',
fields=[
('dn', models.CharField(max_length=200, primary_key=True, serialize=False)),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200, primary_key=True, serialize=False)),
('members', ldapdb.models.fields.ListField(blank=True, db_column='member')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='user',
name='telephone',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AlterField(
model_name='listright',
name='listright',
field=models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[a-z]+$', message='Les groupes unix ne peuvent contenir que des lettres minuscules')]),
),
migrations.AlterField(
model_name='listright',
name='listright',
field=models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[a-z]+$', message='Les groupes unix ne peuvent contenir que des lettres minuscules')]),
),
migrations.CreateModel(
name='Adherent',
fields=[
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('usname', models.CharField(max_length=255)),
],
options={
'abstract': False,
},
bases=('users.user',),
),
migrations.CreateModel(
name='Club',
fields=[
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
bases=('users.user',),
),
migrations.RunSQL(
sql='insert into users_adherent (user_ptr_id, usname) select id, name from users_user',
reverse_sql='insert into users_user (name) select usname from users_adherent',
),
migrations.RemoveField(
model_name='user',
name='name',
),
migrations.RenameField(
model_name='adherent',
old_name='usname',
new_name='name',
),
migrations.AddField(
model_name='adherent',
name='room_adherent',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='topologie.Room'),
),
migrations.AddField(
model_name='club',
name='room_club',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='topologie.Room'),
),
migrations.RunPython(
code=create_move_room,
reverse_code=delete_move_room,
),
migrations.RemoveField(
model_name='user',
name='room',
),
migrations.RenameField(
model_name='adherent',
old_name='room_adherent',
new_name='room',
),
migrations.RenameField(
model_name='club',
old_name='room_club',
new_name='room',
),
migrations.AddField(
model_name='club',
name='administrators',
field=models.ManyToManyField(blank=True, related_name='club_administrator', to='users.Adherent'),
),
migrations.AddField(
model_name='club',
name='members',
field=models.ManyToManyField(blank=True, related_name='club_members', to='users.Adherent'),
),
migrations.AddField(
model_name='user',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
),
migrations.AddField(
model_name='user',
name='is_superuser',
field=models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status'),
),
migrations.AddField(
model_name='user',
name='user_permissions',
field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
),
migrations.RenameField(
model_name='listright',
old_name='listright',
new_name='unix_name',
),
migrations.AddField(
model_name='listright',
name='group_ptr',
field=models.OneToOneField(auto_created=True, blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, serialize=False, to='auth.Group'),
preserve_default=False,
),
migrations.RunPython(
code=create_groups,
reverse_code=delete_groups,
),
migrations.RunPython(
code=transfer_right,
reverse_code=untransfer_right,
),
migrations.AlterUniqueTogether(
name='right',
unique_together=set([]),
),
migrations.RemoveField(
model_name='right',
name='right',
),
migrations.RemoveField(
model_name='right',
name='user',
),
migrations.DeleteModel(
name='Right',
),
migrations.RemoveField(
model_name='listright',
name='id',
),
migrations.AlterField(
model_name='listright',
name='group_ptr',
field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='auth.Group'),
),
migrations.AlterModelOptions(
name='ban',
options={'permissions': (('view_ban', "Peut voir un objet ban quelqu'il soit"),)},
),
migrations.AlterModelOptions(
name='listright',
options={'permissions': (('view_listright', 'Peut voir un objet Group/ListRight'),)},
),
migrations.AlterModelOptions(
name='school',
options={'permissions': (('view_school', 'Peut voir un objet school'),)},
),
migrations.AlterModelOptions(
name='serviceuser',
options={'permissions': (('view_serviceuser', 'Peut voir un objet serviceuser'),)},
),
migrations.AlterModelOptions(
name='user',
options={'permissions': (('change_user_password', "Peut changer le mot de passe d'un user"), ('change_user_state', "Peut éditer l'etat d'un user"), ('change_user_force', 'Peut forcer un déménagement'), ('change_user_shell', "Peut éditer le shell d'un user"), ('change_user_groups', "Peut éditer les groupes d'un user ! Permission critique"), ('view_user', 'Peut voir un objet user quelquonque'))},
),
migrations.AlterModelOptions(
name='whitelist',
options={'permissions': (('view_whitelist', 'Peut voir un objet whitelist'),)},
),
migrations.RunPython(
code=transfer_permissions_0066,
reverse_code=untransfer_permissions_0066,
),
migrations.RunPython(
code=transfer_permissions_0067,
reverse_code=untransfer_permissions_0067,
),
migrations.AlterModelOptions(
name='user',
options={'permissions': (('change_user_password', "Peut changer le mot de passe d'un user"), ('change_user_state', "Peut éditer l'etat d'un user"), ('change_user_force', 'Peut forcer un déménagement'), ('change_user_shell', "Peut éditer le shell d'un user"), ('change_user_groups', "Peut éditer les groupes d'un user ! Permission critique"), ('change_all_users', 'Peut éditer tous les users, y compris ceux dotés de droits. Superdroit'), ('view_user', 'Peut voir un objet user quelquonque'))},
),
migrations.AddField(
model_name='listright',
name='critical',
field=models.BooleanField(default=False),
),
migrations.RunPython(
code=transfer_permissions_0068,
reverse_code=untransfer_permissions_0068,
),
migrations.AddField(
model_name='club',
name='mailing',
field=models.BooleanField(default=False),
),
]