Mark LDAP field names as byte strings
The django-ldapdb code cannot handle unicode field names with real LDAP directories. This commit marks the field names of LDAP entities as byte strings.
This commit is contained in:
parent
1a24cf9c50
commit
54875619aa
1 changed files with 14 additions and 14 deletions
|
@ -39,16 +39,16 @@ class LdapGroup(ldapmodels.Model):
|
|||
# LDAP meta-data
|
||||
base_dn = settings.GROUP_BASE_DN
|
||||
#: list of object classes
|
||||
object_classes = ['posixGroup']
|
||||
object_classes = [b'posixGroup']
|
||||
|
||||
# posixGroup attributes
|
||||
#: group id (`gidNumber`)
|
||||
gid = IntegerField(db_column='gidNumber', unique=True)
|
||||
gid = IntegerField(db_column=b'gidNumber', unique=True)
|
||||
#: group name (`cn`)
|
||||
name = CharField(db_column='cn', max_length=200, primary_key=True)
|
||||
name = CharField(db_column=b'cn', max_length=200, primary_key=True)
|
||||
#: group description (`description`)
|
||||
description = CharField(db_column='description')
|
||||
members = ListField(db_column='memberUid', blank=True)
|
||||
description = CharField(db_column=b'description')
|
||||
members = ListField(db_column=b'memberUid', blank=True)
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
@ -72,25 +72,25 @@ class LdapUser(ldapmodels.Model):
|
|||
"""
|
||||
base_dn = settings.USER_BASE_DN
|
||||
#: list of object classes
|
||||
object_classes = ['account', 'posixAccount']
|
||||
object_classes = [b'account', b'posixAccount']
|
||||
|
||||
# posixAccount
|
||||
#: user id (`uidNumber`)
|
||||
uid = IntegerField(db_column='uidNumber', unique=True)
|
||||
uid = IntegerField(db_column=b'uidNumber', unique=True)
|
||||
#: group id (`gidNumber`) of the user's primary group
|
||||
group = IntegerField(db_column='gidNumber')
|
||||
group = IntegerField(db_column=b'gidNumber')
|
||||
#: GECOS field (`gecos`)
|
||||
gecos = CharField(db_column='gecos')
|
||||
gecos = CharField(db_column=b'gecos')
|
||||
#: home directory (`homeDirectory`)
|
||||
home_directory = CharField(db_column='homeDirectory')
|
||||
home_directory = CharField(db_column=b'homeDirectory')
|
||||
#: login shell (`loginShell`)
|
||||
login_shell = CharField(db_column='loginShell', default='/bin/bash')
|
||||
login_shell = CharField(db_column=b'loginShell', default='/bin/bash')
|
||||
#: user name (`uid`)
|
||||
username = CharField(db_column='uid', primary_key=True)
|
||||
username = CharField(db_column=b'uid', primary_key=True)
|
||||
#: password (`userPassword`) in an LDAP compatible format
|
||||
password = CharField(db_column='userPassword')
|
||||
password = CharField(db_column=b'userPassword')
|
||||
#: common name (`cn`)
|
||||
common_name = CharField(db_column='cn')
|
||||
common_name = CharField(db_column=b'cn')
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue