add LDAP Group Membership Policy
This commit is contained in:
@ -5,7 +5,8 @@ from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
|
||||
from passbook.ldap.models import LDAPSource
|
||||
from passbook.core.forms.policies import GENERAL_FIELDS
|
||||
from passbook.ldap.models import LDAPGroupMembershipPolicy, LDAPSource
|
||||
|
||||
|
||||
class LDAPSourceForm(forms.ModelForm):
|
||||
@ -32,58 +33,18 @@ class LDAPSourceForm(forms.ModelForm):
|
||||
'base_dn': _('Base DN'),
|
||||
}
|
||||
|
||||
# class GeneralSettingsForm(SettingsForm):
|
||||
# """general settings form"""
|
||||
# MODE_AUTHENTICATION_BACKEND = 'auth_backend'
|
||||
# MODE_CREATE_USERS = 'create_users'
|
||||
# MODE_CHOICES = (
|
||||
# (MODE_AUTHENTICATION_BACKEND, _('Authentication Backend')),
|
||||
# (MODE_CREATE_USERS, _('Create Users'))
|
||||
# )
|
||||
|
||||
# namespace = 'passbook.ldap'
|
||||
# settings = ['enabled', 'mode']
|
||||
class LDAPGroupMembershipPolicyForm(forms.ModelForm):
|
||||
"""LDAPGroupMembershipPolicy Form"""
|
||||
|
||||
# widgets = {
|
||||
# 'enabled': forms.BooleanField(required=False),
|
||||
# 'mode': forms.ChoiceField(widget=forms.RadioSelect, choices=MODE_CHOICES),
|
||||
# }
|
||||
class Meta:
|
||||
|
||||
|
||||
# class ConnectionSettings(SettingsForm):
|
||||
# """Connection settings form"""
|
||||
|
||||
# namespace = 'passbook.ldap'
|
||||
# settings = ['server', 'server:tls', 'bind:user', 'bind:password', 'domain']
|
||||
|
||||
# attrs_map = {
|
||||
# 'server': {'placeholder': 'dc1.corp.exmaple.com'},
|
||||
# 'bind:user': {'placeholder': 'Administrator'},
|
||||
# 'domain': {'placeholder': 'corp.example.com'},
|
||||
# }
|
||||
|
||||
# widgets = {
|
||||
# 'server:tls': forms.BooleanField(required=False, label=_('Server TLS')),
|
||||
# }
|
||||
|
||||
|
||||
# class AuthenticationBackendSettings(SettingsForm):
|
||||
# """Authentication backend settings"""
|
||||
|
||||
# namespace = 'passbook.ldap'
|
||||
# settings = ['base']
|
||||
|
||||
# attrs_map = {
|
||||
# 'base': {'placeholder': 'DN in which to search for users'},
|
||||
# }
|
||||
|
||||
|
||||
# class CreateUsersSettings(SettingsForm):
|
||||
# """Create users settings"""
|
||||
|
||||
# namespace = 'passbook.ldap'
|
||||
# settings = ['create_base']
|
||||
|
||||
# attrs_map = {
|
||||
# 'create_base': {'placeholder': 'DN in which to create users'},
|
||||
# }
|
||||
model = LDAPGroupMembershipPolicy
|
||||
fields = GENERAL_FIELDS + ['dn', ]
|
||||
widgets = {
|
||||
'name': forms.TextInput(),
|
||||
'dn': forms.TextInput(),
|
||||
}
|
||||
labels = {
|
||||
'dn': _('DN')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user