# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-15 06:45
from __future__ import unicode_literals

import chemtrails.contrib.permissions.forms.fields
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('auth', '0008_alter_user_username_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='AccessRule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.TextField(default='', verbose_name='description')),
                ('relation_types', django.contrib.postgres.fields.ArrayField(base_field=chemtrails.contrib.permissions.forms.fields.JSONField(default={}), default=list, help_text='List of relation type rule definitions, optionally with a map of properties for matching the relation type node. Example: {"USER": {"is_superuser": true}}, {"GROUP": null}', size=None, verbose_name='relation types')),
                ('is_active', models.BooleanField(default=True, help_text='Uncheck to disable evaluation of the rule in the rule chain.')),
                ('requires_staff', models.BooleanField(default=False, help_text='Requires user which should have permissions evaluated to be a staff user.')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='updated')),
                ('ctype_source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accessrule_ctype_source_set', to='contenttypes.ContentType', verbose_name='source content type')),
                ('ctype_target', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accessrule_ctype_target_set', to='contenttypes.ContentType', verbose_name='target content type')),
                ('permissions', models.ManyToManyField(blank=True, help_text='Required permissions for target node.', related_name='accessrule_permissions', related_query_name='accessrule', to='auth.Permission', verbose_name='access rule permissions')),
            ],
            options={
                'ordering': ('ctype_target', '-created'),
            },
        ),
    ]
