0001_initial.py 16.4 KB
Newer Older
Lukas Burgey's avatar
Lukas Burgey committed
1
# Generated by Django 2.1.3 on 2018-12-05 14:24
Lukas Burgey's avatar
Lukas Burgey committed
2 3 4 5 6 7 8 9 10 11

from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_mysql.models
import feudal.backend.auth.v1.models
import feudal.backend.models.brokers
Lukas Burgey's avatar
Lukas Burgey committed
12
import feudal.backend.models.deployments
Lukas Burgey's avatar
Lukas Burgey committed
13 14 15 16 17 18 19 20 21
import feudal.backend.models.users


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
Lukas Burgey's avatar
Lukas Burgey committed
22
        ('contenttypes', '0002_remove_content_type_name'),
Lukas Burgey's avatar
Lukas Burgey committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('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_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('user_type', models.CharField(choices=[('apiclient', 'API-Client'), ('oidcuser', 'OIDC User'), ('admin', 'Admin')], default='apiclient', max_length=20)),
                ('sub', models.CharField(blank=True, editable=False, max_length=150, null=True)),
                ('password', models.CharField(blank=True, max_length=150, null=True)),
                ('_is_active', models.BooleanField(default=True, editable=False)),
                ('userinfo', django_mysql.models.JSONField(blank=True, default=feudal.backend.models.users.user_info_default, editable=False, null=True)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
Lukas Burgey's avatar
Lukas Burgey committed
48
                'abstract': False,
Lukas Burgey's avatar
Lukas Burgey committed
49 50 51 52 53
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
Lukas Burgey's avatar
Lukas Burgey committed
54 55 56 57 58 59 60 61 62
        migrations.CreateModel(
            name='CredentialState',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('state_target', models.CharField(choices=[('deployed', 'Deployed'), ('not_deployed', 'Not Deployed')], default='not_deployed', max_length=50)),
                ('state', models.CharField(choices=[('deployment_pending', 'VODeployment Pending'), ('removal_pending', 'Removal Pending'), ('deployed', 'Deployed'), ('not_deployed', 'Not Deployed'), ('questionnaire', 'Questionnaire'), ('failed', 'Failed'), ('rejected', 'Rejected')], default='not_deployed', max_length=50)),
                ('_credential_deleted', models.BooleanField(default=False)),
            ],
        ),
Lukas Burgey's avatar
Lukas Burgey committed
63 64 65 66
        migrations.CreateModel(
            name='Deployment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Lukas Burgey's avatar
Lukas Burgey committed
67
                ('state_target', models.CharField(choices=[('deployed', 'Deployed'), ('not_deployed', 'Not Deployed')], default='not_deployed', max_length=50)),
Lukas Burgey's avatar
Lukas Burgey committed
68 69
                ('is_active', models.BooleanField(default=True)),
            ],
Lukas Burgey's avatar
Lukas Burgey committed
70 71 72 73
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
Lukas Burgey's avatar
Lukas Burgey committed
74 75 76 77 78
        ),
        migrations.CreateModel(
            name='DeploymentState',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Lukas Burgey's avatar
Lukas Burgey committed
79 80 81 82
                ('state', models.CharField(choices=[('deployment_pending', 'VODeployment Pending'), ('removal_pending', 'Removal Pending'), ('deployed', 'Deployed'), ('not_deployed', 'Not Deployed'), ('questionnaire', 'Questionnaire'), ('failed', 'Failed'), ('rejected', 'Rejected')], default='not_deployed', max_length=50)),
                ('message', models.TextField(default='', max_length=300)),
                ('questionnaire', django_mysql.models.JSONField(blank=True, default=feudal.backend.models.deployments.questionnaire_default, null=True)),
                ('credentials', django_mysql.models.JSONField(blank=True, default=feudal.backend.models.deployments.credential_default, null=True)),
Lukas Burgey's avatar
Lukas Burgey committed
83 84 85
            ],
        ),
        migrations.CreateModel(
Lukas Burgey's avatar
Lukas Burgey committed
86
            name='EntitlementNameSpace',
Lukas Burgey's avatar
Lukas Burgey committed
87 88
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Lukas Burgey's avatar
Lukas Burgey committed
89
                ('name', models.CharField(max_length=200, unique=True)),
Lukas Burgey's avatar
Lukas Burgey committed
90 91 92 93 94 95 96 97 98 99 100
            ],
        ),
        migrations.CreateModel(
            name='OIDCConfig',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('client_id', models.CharField(max_length=200)),
                ('client_secret', models.CharField(max_length=200)),
                ('issuer_uri', models.CharField(max_length=200)),
                ('enabled', models.BooleanField(default=False)),
                ('name', models.CharField(max_length=200)),
Lukas Burgey's avatar
Lukas Burgey committed
101 102 103 104
                ('redirect_uri', models.CharField(default='https://<domain>/backend/auth/v1/callback', max_length=200)),
                ('scopes', django_mysql.models.JSONField(default=feudal.backend.auth.v1.models.scopes_default, help_text='The scopes we use when requesting user infos')),
                ('userinfo_field_groups', models.CharField(blank=True, default='', help_text="The field in the userinfo (served by this IdP) that contains groups of the user.\n        Leave blank if you don't want to use groups of this IdP", max_length=200)),
                ('userinfo_field_entitlements', models.CharField(blank=True, default='', help_text="The field in the userinfo (served by this IdP) that contains entitlements of the user.\n        Leave blank if you don't want to use entitlements of this IdP", max_length=200)),
Lukas Burgey's avatar
Lukas Burgey committed
105 106 107 108 109 110 111
            ],
        ),
        migrations.CreateModel(
            name='RabbitMQInstance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('host', models.CharField(default='localhost', max_length=150)),
Lukas Burgey's avatar
Lukas Burgey committed
112
                ('vhost', models.CharField(default='/', max_length=150)),
Lukas Burgey's avatar
Lukas Burgey committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
                ('exchanges', django_mysql.models.JSONField(blank=True, default=feudal.backend.models.brokers.exchanges_default, null=True)),
                ('port', models.IntegerField(default=15672)),
                ('username', models.CharField(default='guest', max_length=150)),
                ('password', models.CharField(default='guest', max_length=150)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, unique=True)),
                ('description', models.TextField(blank=True, max_length=300)),
            ],
        ),
        migrations.CreateModel(
            name='Site',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, unique=True)),
                ('description', models.TextField(blank=True, max_length=300)),
                ('client', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='site', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='SSHPublicKey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('key', models.TextField(max_length=1000)),
                ('deleted', models.BooleanField(default=False, editable=False)),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='_ssh_keys', to=settings.AUTH_USER_MODEL)),
            ],
        ),
Lukas Burgey's avatar
Lukas Burgey committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
        migrations.CreateModel(
            name='VO',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True)),
                ('description', models.TextField(blank=True, max_length=1000, null=True)),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Entitlement',
            fields=[
                ('vo_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='backend.VO')),
                ('full_name', models.CharField(max_length=200)),
                ('group_authority', models.CharField(blank=True, max_length=200, null=True)),
                ('role', models.CharField(blank=True, max_length=200, null=True)),
                ('name_space', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='entitlements', to='backend.EntitlementNameSpace')),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
            bases=('backend.VO',),
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('vo_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='backend.VO')),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
            bases=('backend.VO',),
        ),
        migrations.CreateModel(
            name='ServiceDeployment',
            fields=[
                ('deployment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='backend.Deployment')),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
            bases=('backend.Deployment',),
        ),
        migrations.CreateModel(
            name='VODeployment',
            fields=[
                ('deployment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='backend.Deployment')),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
            bases=('backend.Deployment',),
        ),
Lukas Burgey's avatar
Lukas Burgey committed
209
        migrations.AddField(
Lukas Burgey's avatar
Lukas Burgey committed
210 211 212
            model_name='vo',
            name='idp',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='vos', to='backend.OIDCConfig'),
Lukas Burgey's avatar
Lukas Burgey committed
213 214
        ),
        migrations.AddField(
Lukas Burgey's avatar
Lukas Burgey committed
215 216 217
            model_name='vo',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_backend.vo_set+', to='contenttypes.ContentType'),
Lukas Burgey's avatar
Lukas Burgey committed
218 219
        ),
        migrations.AddField(
Lukas Burgey's avatar
Lukas Burgey committed
220
            model_name='service',
Lukas Burgey's avatar
Lukas Burgey committed
221
            name='site',
Lukas Burgey's avatar
Lukas Burgey committed
222 223 224 225 226 227
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='services', to='backend.Site'),
        ),
        migrations.AddField(
            model_name='service',
            name='vos',
            field=models.ManyToManyField(blank=True, related_name='services', to='backend.VO'),
Lukas Burgey's avatar
Lukas Burgey committed
228 229 230
        ),
        migrations.AddField(
            model_name='deploymentstate',
Lukas Burgey's avatar
Lukas Burgey committed
231 232
            name='deployments',
            field=models.ManyToManyField(related_name='states', to='backend.Deployment'),
Lukas Burgey's avatar
Lukas Burgey committed
233 234
        ),
        migrations.AddField(
Lukas Burgey's avatar
Lukas Burgey committed
235
            model_name='deploymentstate',
Lukas Burgey's avatar
Lukas Burgey committed
236
            name='service',
Lukas Burgey's avatar
Lukas Burgey committed
237 238 239 240 241 242 243 244 245 246 247
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='states', to='backend.Service'),
        ),
        migrations.AddField(
            model_name='deploymentstate',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='states', to='backend.Site'),
        ),
        migrations.AddField(
            model_name='deploymentstate',
            name='user',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='states', to=settings.AUTH_USER_MODEL),
Lukas Burgey's avatar
Lukas Burgey committed
248 249 250
        ),
        migrations.AddField(
            model_name='deployment',
Lukas Burgey's avatar
Lukas Burgey committed
251 252
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_backend.deployment_set+', to='contenttypes.ContentType'),
Lukas Burgey's avatar
Lukas Burgey committed
253 254 255 256 257 258
        ),
        migrations.AddField(
            model_name='deployment',
            name='user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='deployments', to=settings.AUTH_USER_MODEL),
        ),
Lukas Burgey's avatar
Lukas Burgey committed
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
        migrations.AddField(
            model_name='credentialstate',
            name='credential',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credential_states', to='backend.SSHPublicKey'),
        ),
        migrations.AddField(
            model_name='credentialstate',
            name='target',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credential_states', to='backend.DeploymentState'),
        ),
        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'),
        ),
Lukas Burgey's avatar
Lukas Burgey committed
274 275 276 277 278 279 280 281 282 283
        migrations.AddField(
            model_name='user',
            name='idp',
            field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to='backend.OIDCConfig'),
        ),
        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'),
        ),
Lukas Burgey's avatar
Lukas Burgey committed
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
        migrations.AddField(
            model_name='user',
            name='vos',
            field=models.ManyToManyField(blank=True, to='backend.VO'),
        ),
        migrations.AddField(
            model_name='vodeployment',
            name='vo',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vo_deployments', to='backend.VO'),
        ),
        migrations.AddField(
            model_name='servicedeployment',
            name='service',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_deployments', to='backend.Service'),
        ),
Lukas Burgey's avatar
Lukas Burgey committed
299
    ]