# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2018-03-23 08:05
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='AssetActionPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('can_change', models.BooleanField(default=True, verbose_name='是否有修改权限')),
                ('can_add', models.BooleanField(default=True, verbose_name='是否有添加权限')),
                ('can_delete', models.BooleanField(default=True, verbose_name='是否有删除权限')),
                ('can_view', models.BooleanField(default=True, verbose_name='是否有查看权限')),
                ('asset_groups', models.ManyToManyField(blank=True, to='assets.AssetGroup', verbose_name='资产组')),
                ('assets', models.ManyToManyField(blank=True, to='assets.Asset', verbose_name='资产')),
            ],
            options={
                'verbose_name': '资产操作权限',
                'verbose_name_plural': '资产操作权限',
            },
        ),
        migrations.CreateModel(
            name='Permission',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True, verbose_name='权限名')),
                ('is_active', models.BooleanField(default=True, verbose_name='激活')),
                ('description', models.CharField(blank=True, max_length=256, null=True, verbose_name='描述')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='修改时间')),
                ('user_groups', models.ManyToManyField(blank=True, to='accounts.UserGroup', verbose_name='用户组')),
                ('users', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
            ],
            options={
                'verbose_name': '权限总表',
                'verbose_name_plural': '权限总表',
            },
        ),
        migrations.CreateModel(
            name='UrlViewPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.URLField(verbose_name='URL')),
                ('permission', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='permission.Permission')),
            ],
            options={
                'verbose_name': 'URL访问权限',
                'verbose_name_plural': 'URL访问权限',
            },
        ),
        migrations.AddField(
            model_name='assetactionpermission',
            name='permission',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='permission.Permission'),
        ),
    ]
