# Generated by Django 2.1.2 on 2018-11-07 08:32

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('provider', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='ApplicationPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('repr', models.CharField(max_length=255, verbose_name='Name')),
                ('codename', models.CharField(max_length=100, verbose_name='Code name')),
                ('app_label', models.CharField(max_length=100, verbose_name='App label')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
            ],
            options={
                'verbose_name': 'Application permission',
                'verbose_name_plural': 'Application permissions',
                'ordering': ['application', 'repr'],
            },
        ),
        migrations.CreateModel(
            name='ApplicationPermissionGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Name')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Name')),
                ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
                ('permissions', models.ManyToManyField(blank=True, to='provider.ApplicationPermission')),
            ],
            options={
                'verbose_name': 'Application permission group',
                'verbose_name_plural': 'Application permission groups',
                'ordering': ['application', 'name'],
            },
        ),
        migrations.CreateModel(
            name='ApplicationUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='Superuser status')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Name')),
                ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
                ('groups', models.ManyToManyField(blank=True, to='provider.ApplicationPermissionGroup')),
                ('permissions', models.ManyToManyField(blank=True, to='provider.ApplicationPermission')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Application user',
                'verbose_name_plural': 'Application users',
            },
        ),
        migrations.AlterUniqueTogether(
            name='applicationuser',
            unique_together={('user', 'application')},
        ),
        migrations.AlterUniqueTogether(
            name='applicationpermissiongroup',
            unique_together={('application', 'name')},
        ),
        migrations.AlterUniqueTogether(
            name='applicationpermission',
            unique_together={('application', 'codename', 'app_label')},
        ),
    ]
