all: implement black as code formatter
This commit is contained in:
@ -10,34 +10,45 @@ from passbook.core.models import Group, PropertyMapping, Source
|
||||
class LDAPSource(Source):
|
||||
"""LDAP Authentication source"""
|
||||
|
||||
server_uri = models.TextField(validators=[URLValidator(schemes=['ldap', 'ldaps'])])
|
||||
server_uri = models.TextField(validators=[URLValidator(schemes=["ldap", "ldaps"])])
|
||||
bind_cn = models.TextField()
|
||||
bind_password = models.TextField()
|
||||
start_tls = models.BooleanField(default=False)
|
||||
|
||||
base_dn = models.TextField()
|
||||
additional_user_dn = models.TextField(help_text=_('Prepended to Base DN for User-queries.'))
|
||||
additional_group_dn = models.TextField(help_text=_('Prepended to Base DN for Group-queries.'))
|
||||
additional_user_dn = models.TextField(
|
||||
help_text=_("Prepended to Base DN for User-queries.")
|
||||
)
|
||||
additional_group_dn = models.TextField(
|
||||
help_text=_("Prepended to Base DN for Group-queries.")
|
||||
)
|
||||
|
||||
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.'))
|
||||
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(Group, blank=True, null=True,
|
||||
default=None, on_delete=models.SET_DEFAULT)
|
||||
sync_parent_group = models.ForeignKey(
|
||||
Group, blank=True, null=True, default=None, on_delete=models.SET_DEFAULT
|
||||
)
|
||||
|
||||
form = 'passbook.sources.ldap.forms.LDAPSourceForm'
|
||||
form = "passbook.sources.ldap.forms.LDAPSourceForm"
|
||||
|
||||
class Meta:
|
||||
|
||||
verbose_name = _('LDAP Source')
|
||||
verbose_name_plural = _('LDAP Sources')
|
||||
verbose_name = _("LDAP Source")
|
||||
verbose_name_plural = _("LDAP Sources")
|
||||
|
||||
|
||||
class LDAPPropertyMapping(PropertyMapping):
|
||||
@ -46,12 +57,12 @@ class LDAPPropertyMapping(PropertyMapping):
|
||||
ldap_property = models.TextField()
|
||||
object_field = models.TextField()
|
||||
|
||||
form = 'passbook.sources.ldap.forms.LDAPPropertyMappingForm'
|
||||
form = "passbook.sources.ldap.forms.LDAPPropertyMappingForm"
|
||||
|
||||
def __str__(self):
|
||||
return f"LDAP Property Mapping {self.ldap_property} -> {self.object_field}"
|
||||
|
||||
class Meta:
|
||||
|
||||
verbose_name = _('LDAP Property Mapping')
|
||||
verbose_name_plural = _('LDAP Property Mappings')
|
||||
verbose_name = _("LDAP Property Mapping")
|
||||
verbose_name_plural = _("LDAP Property Mappings")
|
||||
|
||||
Reference in New Issue
Block a user