# Generated by Django 3.0.6 on 2020-05-19 22:08

import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("authentik_core", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="LDAPPropertyMapping",
            fields=[
                (
                    "propertymapping_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="authentik_core.PropertyMapping",
                    ),
                ),
                ("object_field", models.TextField()),
            ],
            options={
                "verbose_name": "LDAP Property Mapping",
                "verbose_name_plural": "LDAP Property Mappings",
            },
            bases=("authentik_core.propertymapping",),
        ),
        migrations.CreateModel(
            name="LDAPSource",
            fields=[
                (
                    "source_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="authentik_core.Source",
                    ),
                ),
                (
                    "server_uri",
                    models.TextField(
                        validators=[
                            django.core.validators.URLValidator(
                                schemes=["ldap", "ldaps"]
                            )
                        ],
                        verbose_name="Server URI",
                    ),
                ),
                ("bind_cn", models.TextField(verbose_name="Bind CN")),
                ("bind_password", models.TextField()),
                (
                    "start_tls",
                    models.BooleanField(default=False, verbose_name="Enable Start TLS"),
                ),
                ("base_dn", models.TextField(verbose_name="Base DN")),
                (
                    "additional_user_dn",
                    models.TextField(
                        help_text="Prepended to Base DN for User-queries.",
                        verbose_name="Addition User DN",
                    ),
                ),
                (
                    "additional_group_dn",
                    models.TextField(
                        help_text="Prepended to Base DN for Group-queries.",
                        verbose_name="Addition Group DN",
                    ),
                ),
                (
                    "user_object_filter",
                    models.TextField(
                        default="(objectCategory=Person)",
                        help_text="Consider Objects matching this filter to be Users.",
                    ),
                ),
                (
                    "user_group_membership_field",
                    models.TextField(
                        default="memberOf",
                        help_text="Field which contains Groups of user.",
                    ),
                ),
                (
                    "group_object_filter",
                    models.TextField(
                        default="(objectCategory=Group)",
                        help_text="Consider Objects matching this filter to be Groups.",
                    ),
                ),
                (
                    "object_uniqueness_field",
                    models.TextField(
                        default="objectSid",
                        help_text="Field which contains a unique Identifier.",
                    ),
                ),
                ("sync_groups", models.BooleanField(default=True)),
                (
                    "sync_parent_group",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.SET_DEFAULT,
                        to="authentik_core.Group",
                    ),
                ),
            ],
            options={
                "verbose_name": "LDAP Source",
                "verbose_name_plural": "LDAP Sources",
            },
            bases=("authentik_core.source",),
        ),
    ]
