ldap: add Source Creation form

This commit is contained in:
Jens Langhammer 2018-11-26 18:22:38 +01:00
parent 08a5c98823
commit 225dc112e7
3 changed files with 19 additions and 8 deletions

View file

@ -1,11 +1,20 @@
# """Supervisr Mod LDAP Forms"""
"""passbook LDAP Forms"""
# from django import forms
# from django.utils.translation import ugettext_lazy as _
from django import forms
# from supervisr.core.forms.settings import SettingsForm
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.ldap.models import LDAPSource
class LDAPSourceForm(forms.ModelForm):
"""LDAPSource Form"""
class Meta:
model = LDAPSource
fields = SOURCE_FORM_FIELDS + ['server_uri', 'bind_cn', 'bind_password',
'type', 'domain', 'base_dn', 'create_user', 'reset_password']
# class GeneralSettingsForm(SettingsForm):
# """general settings form"""
# MODE_AUTHENTICATION_BACKEND = 'auth_backend'

View file

@ -3,8 +3,6 @@
from django.db import models
from django.utils.translation import gettext as _
# from passbook.core.models import (CreatedUpdatedModel, ProductExtension,
# UUIDModel)
from passbook.core.models import Source
@ -28,6 +26,8 @@ class LDAPSource(Source):
create_user = models.BooleanField(default=False)
reset_password = models.BooleanField(default=True)
form = 'passbook.ldap.forms.LDAPSourceForm'
class Meta:
verbose_name = _('LDAP Source')

View file

@ -2,6 +2,7 @@
from django import forms
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.oauth_client.models import OAuthSource
@ -11,5 +12,6 @@ class OAuthSourceForm(forms.ModelForm):
class Meta:
model = OAuthSource
# pylint: disable=modelform-uses-exclude
exclude = []
fields = SOURCE_FORM_FIELDS + ['provider_type', 'request_token_url', 'authorization_url',
'access_token_url', 'profile_url', 'consumer_key',
'consumer_secret']