Commit 579efe4d authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root
Browse files

Reecriture des migrations et correction de bug pour la creation initiale de admin

parent 4cb7aadc
......@@ -17,17 +17,20 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('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, verbose_name='last login', null=True)),
('last_login', models.DateTimeField(null=True, blank=True, verbose_name='last login')),
('name', models.CharField(max_length=255)),
('surname', models.CharField(max_length=255)),
('pseudo', models.CharField(max_length=32, help_text='Doit contenir uniquement des lettres, chiffres, ou tirets', unique=True, validators=[users.models.linux_user_validator])),
('pseudo', models.CharField(unique=True, max_length=32, validators=[users.models.linux_user_validator], help_text='Doit contenir uniquement des lettres, chiffres, ou tirets. ')),
('email', models.EmailField(max_length=254)),
('comment', models.CharField(max_length=255, help_text='Commentaire, promo', blank=True)),
('state', models.IntegerField(default=0, choices=[(0, 'STATE_ACTIVE'), (1, 'STATE_DEACTIVATED'), (2, 'STATE_ARCHIVED')])),
('comment', models.CharField(blank=True, max_length=255, help_text='Commentaire, promo')),
('state', models.IntegerField(choices=[(0, 'STATE_ACTIVE'), (1, 'STATE_DEACTIVATED'), (2, 'STATE_ARCHIVED')], default=0)),
('registered', models.DateTimeField(auto_now_add=True)),
('uid_number', models.IntegerField(unique=True, default=users.models.User.auto_uid)),
('uid_number', models.IntegerField(unique=True, null=True, default=users.models.User.auto_uid)),
('mail_account_state', models.BooleanField(default=False, help_text='Cocher pour activer')),
('mail_account', models.CharField(null=True, max_length=32, unique=True, blank=True, validators=[users.models.mail_check], help_text="N'indiquer que le préfixe de l'adresse (devant @ares.fr)")),
('mail_quota', models.IntegerField(default=100)),
],
options={
'abstract': False,
......@@ -36,17 +39,18 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='LdapUser',
fields=[
('dn', models.CharField(max_length=200)),
('dn', models.CharField(max_length=200, primary_key=True, serialize=False)),
('gid', ldapdb.models.fields.IntegerField(db_column='gidNumber')),
('name', ldapdb.models.fields.CharField(max_length=200, db_column='cn')),
('uid', ldapdb.models.fields.CharField(primary_key=True, max_length=200, db_column='uid', serialize=False)),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200)),
('uid', ldapdb.models.fields.CharField(db_column='uid', max_length=200)),
('uidNumber', ldapdb.models.fields.IntegerField(unique=True, db_column='uidNumber')),
('sn', ldapdb.models.fields.CharField(max_length=200, db_column='sn')),
('loginShell', ldapdb.models.fields.CharField(max_length=200, blank=True, null=True, db_column='loginShell')),
('mail', ldapdb.models.fields.CharField(max_length=200, db_column='mail')),
('home_directory', ldapdb.models.fields.CharField(max_length=200, db_column='homeDirectory')),
('display_name', ldapdb.models.fields.CharField(max_length=200, blank=True, null=True, db_column='displayName')),
('user_password', ldapdb.models.fields.CharField(max_length=200, blank=True, null=True, db_column='userPassword')),
('sn', ldapdb.models.fields.CharField(db_column='sn', max_length=200)),
('loginShell', ldapdb.models.fields.CharField(null=True, db_column='loginShell', max_length=200, blank=True)),
('mail', ldapdb.models.fields.CharField(db_column='mail', max_length=200)),
('home_directory', ldapdb.models.fields.CharField(db_column='homeDirectory', max_length=200)),
('display_name', ldapdb.models.fields.CharField(null=True, db_column='displayName', max_length=200, blank=True)),
('user_password', ldapdb.models.fields.CharField(null=True, db_column='userPassword', max_length=200, blank=True)),
('shadow_expire', ldapdb.models.fields.IntegerField(null=True, db_column='shadowExpire', blank=True)),
],
options={
'abstract': False,
......@@ -55,35 +59,51 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='LdapUserGroup',
fields=[
('dn', models.CharField(max_length=200)),
('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(primary_key=True, max_length=200, db_column='cn', serialize=False)),
('members', ldapdb.models.fields.ListField(db_column='memberUid', blank=True)),
('name', ldapdb.models.fields.CharField(db_column='cn', max_length=200)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='ListDomain',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain', models.CharField(unique=True, max_length=255)),
],
),
migrations.CreateModel(
name='ListRight',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('listright', models.CharField(max_length=255, unique=True)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('listright', models.CharField(unique=True, max_length=255)),
('gid', models.IntegerField(unique=True, null=True)),
],
),
migrations.CreateModel(
name='ListShell',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('shell', models.CharField(max_length=255, unique=True)),
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('shell', models.CharField(unique=True, max_length=255)),
],
),
migrations.CreateModel(
name='MailAlias',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('alias', models.CharField(unique=True, max_length=32, validators=[users.models.mail_check], help_text="N'indiquer que le préfixe de l'alias (devant @ares.fr)")),
('redirection', models.EmailField(max_length=254)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Request',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('type', models.CharField(max_length=2, choices=[('PW', 'Mot de passe'), ('EM', 'Email')])),
('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()),
......@@ -93,7 +113,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Right',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('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.ListRight')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
......@@ -101,7 +121,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='user',
name='shell',
field=models.ForeignKey(to='users.ListShell', null=True, on_delete=django.db.models.deletion.PROTECT, blank=True),
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, null=True, blank=True, to='users.ListShell'),
),
migrations.AlterUniqueTogether(
name='right',
......
......@@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import users.models
import ldapdb.models.fields
class Migration(migrations.Migration):
......@@ -13,8 +13,13 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='user',
name='uid_number',
field=models.IntegerField(unique=True, null=True, default=users.models.User.auto_uid),
model_name='ldapuser',
name='uid',
field=ldapdb.models.fields.CharField(primary_key=True, serialize=False, max_length=200, db_column='uid'),
),
migrations.AlterField(
model_name='ldapusergroup',
name='name',
field=ldapdb.models.fields.CharField(primary_key=True, serialize=False, max_length=200, db_column='cn'),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20160804_0312'),
]
operations = [
migrations.RemoveField(
model_name='listright',
name='gid',
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_remove_listright_gid'),
]
operations = [
migrations.AddField(
model_name='listright',
name='gid',
field=models.IntegerField(unique=True, null=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import ldapdb.models.fields
class Migration(migrations.Migration):
dependencies = [
('users', '0004_listright_gid'),
]
operations = [
migrations.AddField(
model_name='ldapuser',
name='shadow_expire',
field=ldapdb.models.fields.IntegerField(max_length=200, db_column='shadowExpire', null=True, blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import django.db.models.deletion
import ldapdb.models.fields
class Migration(migrations.Migration):
dependencies = [
('users', '0005_ldapuser_shadow_expire'),
]
operations = [
migrations.CreateModel(
name='MailAlias',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')),
('alias', models.EmailField(max_length=254, unique=True)),
('redirection', models.EmailField(max_length=254)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=django.db.models.deletion.PROTECT)),
],
),
migrations.AlterField(
model_name='ldapuser',
name='shadow_expire',
field=ldapdb.models.fields.IntegerField(null=True, db_column='shadowExpire', blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20160825_2213'),
]
operations = [
migrations.AlterField(
model_name='mailalias',
name='alias',
field=models.CharField(max_length=32, unique=True, help_text="N'indiquer que le préfixe de l'alias (@ares.fr)", validators=[users.models.mail_check]),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20160826_0024'),
]
operations = [
migrations.AddField(
model_name='user',
name='mail_account',
field=models.EmailField(max_length=254, unique=True, null=True),
),
migrations.AddField(
model_name='user',
name='mail_quota',
field=models.IntegerField(default=100),
),
migrations.AlterField(
model_name='mailalias',
name='alias',
field=models.CharField(max_length=32, validators=[users.models.mail_check], help_text="N'indiquer que le préfixe de l'alias (devant @ares.fr)", unique=True),
),
migrations.AlterField(
model_name='user',
name='pseudo',
field=models.CharField(max_length=32, validators=[users.models.linux_user_validator], help_text='Doit contenir uniquement des lettres, chiffres, ou tirets. ', unique=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0008_auto_20160827_1349'),
]
operations = [
migrations.AddField(
model_name='user',
name='mail_account_state',
field=models.BooleanField(help_text='Cocher pour activer', default=False),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0009_user_mail_account_state'),
]
operations = [
migrations.AlterField(
model_name='user',
name='mail_account',
field=models.CharField(help_text="N'indiquer que le préfixe de l'adresse (devant @ares.fr)", validators=[users.models.mail_check], max_length=32, blank=True, unique=True, null=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0010_auto_20160827_1628'),
]
operations = [
migrations.CreateModel(
name='ListDomain',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('domain', models.CharField(max_length=255, unique=True)),
],
),
]
......@@ -35,6 +35,7 @@ def get_admin_right():
admin_right = ListRight.objects.get(listright="admin")
except ListRight.DoesNotExist:
admin_right = ListRight(listright="admin")
admin_right.gid = LDAP['admin_gid']
admin_right.save()
return admin_right
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment