Move LDAP Source to DB

This commit is contained in:
Jens Langhammer 2018-11-26 17:18:56 +01:00
parent bcf9db59e2
commit 98e10a1ca9
6 changed files with 68 additions and 7 deletions

View File

@ -0,0 +1,35 @@
# Generated by Django 2.1.3 on 2018-11-26 15:17
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('passbook_core', '0003_rule_order'),
]
operations = [
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='passbook_core.Source')),
('server_uri', models.TextField()),
('bind_cn', models.TextField()),
('bind_password', models.TextField()),
('type', models.CharField(choices=[('ad', 'ad'), ('generic', 'generic')], max_length=20)),
('domain', models.TextField()),
('base_dn', models.TextField()),
('create_user', models.BooleanField(default=False)),
('reset_password', models.BooleanField(default=True)),
],
options={
'verbose_name': 'LDAP Source',
'verbose_name_plural': 'LDAP Sources',
},
bases=('passbook_core.source',),
),
]

View File

View File

@ -1,11 +1,37 @@
# """Supervisr mod_ldap Models"""
"""passbook LDAP Models"""
# from django.contrib.auth.models import Group
# from django.db import models
from django.db import models
from django.utils.translation import gettext as _
# from supervisr.core.fields import JSONField
# from passbook.core.models import (CreatedUpdatedModel, ProductExtension,
# UUIDModel)
from passbook.core.models import Source
class LDAPSource(Source):
"""LDAP Authentication source"""
TYPE_ACTIVE_DIRECTORY = 'ad'
TYPE_GENERIC = 'generic'
TYPES = (
(TYPE_ACTIVE_DIRECTORY, TYPE_ACTIVE_DIRECTORY),
(TYPE_GENERIC, TYPE_GENERIC),
)
server_uri = models.TextField()
bind_cn = models.TextField()
bind_password = models.TextField()
type = models.CharField(max_length=20, choices=TYPES)
domain = models.TextField()
base_dn = models.TextField()
create_user = models.BooleanField(default=False)
reset_password = models.BooleanField(default=True)
class Meta:
verbose_name = _('LDAP Source')
verbose_name_plural = _('LDAP Sources')
# class LDAPModification(UUIDModel, CreatedUpdatedModel):

View File

@ -1,9 +1,9 @@
"""Oauth2 provider product extension"""
from django.utils.translation import gettext as _
from oauth2_provider.models import AbstractApplication
from passbook.core.models import Provider
from django.utils.translation import gettext as _
class OAuth2Provider(Provider, AbstractApplication):

View File

@ -1,7 +1,7 @@
# Generated by Django 2.1.3 on 2018-11-26 15:09
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,11 +1,11 @@
"""passbook saml_idp Models"""
from django.db import models
from django.utils.translation import gettext as _
from passbook.core.models import Provider
from passbook.lib.utils.reflection import class_to_path
from passbook.saml_idp.base import Processor
from django.utils.translation import gettext as _
class SAMLProvider(Provider):