# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-05-01 11:00
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_fsm
import jsonfield.fields
import model_utils.fields
import nodeconductor.core.fields
import nodeconductor.core.models
import nodeconductor.core.validators
import nodeconductor.logging.loggers
import taggit.managers


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0002_auto_20150616_2121'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('core', '0007_user_token_lifetime'),
        ('structure', '0047_privateservicesettings_sharedservicesettings'),
    ]

    operations = [
        migrations.CreateModel(
            name='LDAPService',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', nodeconductor.core.fields.UUIDField()),
                ('available_for_all', models.BooleanField(default=False, help_text='Service will be automatically added to all customers projects if it is available for all')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Customer', verbose_name='organization')),
            ],
            options={
                'verbose_name': 'LDAP provider',
                'verbose_name_plural': 'LDAP providers',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='LDAPServiceProjectLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Project')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='nodeconductor_ldap.LDAPService')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'LDAP provider project link',
                'verbose_name_plural': 'LDAP provider project links',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='LDAPUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[nodeconductor.core.validators.validate_name], verbose_name='name')),
                ('uuid', nodeconductor.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('backend_id', models.CharField(blank=True, max_length=255)),
                ('attributes', jsonfield.fields.JSONField(default={}, help_text='LDAP entry attributes')),
                ('service_project_link', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='users', to='nodeconductor_ldap.LDAPServiceProjectLink')),
                ('ssh_public_key', models.ForeignKey(blank=True, help_text='SSH public key to propagate to the LDAP User.', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SshPublicKey')),
                ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'LDAP user',
                'verbose_name_plural': 'LDAP user',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.core.models.BackendModelMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.AddField(
            model_name='ldapservice',
            name='projects',
            field=models.ManyToManyField(related_name='ldap_service', through='nodeconductor_ldap.LDAPServiceProjectLink', to='structure.Project'),
        ),
        migrations.AddField(
            model_name='ldapservice',
            name='settings',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.ServiceSettings'),
        ),
        migrations.AlterUniqueTogether(
            name='ldapuser',
            unique_together=set([('service_project_link', 'user')]),
        ),
        migrations.AlterUniqueTogether(
            name='ldapserviceprojectlink',
            unique_together=set([('service', 'project')]),
        ),
        migrations.AlterUniqueTogether(
            name='ldapservice',
            unique_together=set([('customer', 'settings')]),
        ),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-05-01 11:00
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_fsm
import jsonfield.fields
import model_utils.fields
import nodeconductor.core.fields
import nodeconductor.core.models
import nodeconductor.core.validators
import nodeconductor.logging.loggers
import taggit.managers


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0002_auto_20150616_2121'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('core', '0007_user_token_lifetime'),
        ('structure', '0047_privateservicesettings_sharedservicesettings'),
    ]

    operations = [
        migrations.CreateModel(
            name='LDAPService',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', nodeconductor.core.fields.UUIDField()),
                ('available_for_all', models.BooleanField(default=False, help_text='Service will be automatically added to all customers projects if it is available for all')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Customer', verbose_name='organization')),
            ],
            options={
                'verbose_name': 'LDAP provider',
                'verbose_name_plural': 'LDAP providers',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='LDAPServiceProjectLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Project')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='nodeconductor_ldap.LDAPService')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'LDAP provider project link',
                'verbose_name_plural': 'LDAP provider project links',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='LDAPUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[nodeconductor.core.validators.validate_name], verbose_name='name')),
                ('uuid', nodeconductor.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('backend_id', models.CharField(blank=True, max_length=255)),
                ('attributes', jsonfield.fields.JSONField(default={}, help_text='LDAP entry attributes')),
                ('service_project_link', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='users', to='nodeconductor_ldap.LDAPServiceProjectLink')),
                ('ssh_public_key', models.ForeignKey(blank=True, help_text='SSH public key to propagate to the LDAP User.', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.SshPublicKey')),
                ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'LDAP user',
                'verbose_name_plural': 'LDAP user',
            },
            bases=(nodeconductor.core.models.DescendantMixin, nodeconductor.core.models.BackendModelMixin, nodeconductor.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.AddField(
            model_name='ldapservice',
            name='projects',
            field=models.ManyToManyField(related_name='ldap_service', through='nodeconductor_ldap.LDAPServiceProjectLink', to='structure.Project'),
        ),
        migrations.AddField(
            model_name='ldapservice',
            name='settings',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.ServiceSettings'),
        ),
        migrations.AlterUniqueTogether(
            name='ldapuser',
            unique_together=set([('service_project_link', 'user')]),
        ),
        migrations.AlterUniqueTogether(
            name='ldapserviceprojectlink',
            unique_together=set([('service', 'project')]),
        ),
        migrations.AlterUniqueTogether(
            name='ldapservice',
            unique_together=set([('customer', 'settings')]),
        ),
    ]

# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-05-01 11:00