Parcourir la source

Fix params type to unicode for ldapdb stuff

See https://github.com/django-ldapdb/django-ldapdb/issues/91
Jocelyn Delalande il y a 7 ans
Parent
commit
02dc354936
3 fichiers modifiés avec 38 ajouts et 38 suppressions
  1. 9 9
      coin/dsl_ldap/models.py
  2. 18 18
      coin/members/models.py
  3. 11 11
      vpn/models.py

+ 9 - 9
coin/dsl_ldap/models.py

@@ -143,16 +143,16 @@ class DSLConfiguration(CoinLdapSyncMixin, Configuration):
 
 class LdapDSLConfig(ldapdb.models.Model):
     base_dn = settings.DSL_CONF_BASE_DN # "ou=radius,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-    object_classes = [b'top', b'radiusObjectProfile', b'radiusprofile', b'ipHost']
-
-    login = CharField(db_column=b'cn', primary_key=True, max_length=255)
-    password = CharField(db_column=b'userPassword', max_length=255)
-    cleartext_password = CharField(db_column=b'description', max_length=255)
-    active = CharField(db_column=b'dialupAccess', max_length=3)
-    ipv4_endpoint = CharField(db_column=b'radiusFramedIPAddress', max_length=16)
-    ranges_v4 = ListField(db_column=b'radiusFramedRoute')
+    object_classes = ['top', 'radiusObjectProfile', 'radiusprofile', 'ipHost']
+
+    login = CharField(db_column='cn', primary_key=True, max_length=255)
+    password = CharField(db_column='userPassword', max_length=255)
+    cleartext_password = CharField(db_column='description', max_length=255)
+    active = CharField(db_column='dialupAccess', max_length=3)
+    ipv4_endpoint = CharField(db_column='radiusFramedIPAddress', max_length=16)
+    ranges_v4 = ListField(db_column='radiusFramedRoute')
     # This field is multi-valued, but mandatory...
-    ranges_v6 = ListField(db_column=b'ipHostNumber')
+    ranges_v6 = ListField(db_column='ipHostNumber')
 
     def __unicode__(self):
         return self.login

+ 18 - 18
coin/members/models.py

@@ -466,27 +466,27 @@ class MembershipFee(models.Model):
 class LdapUser(ldapdb.models.Model):
     # "ou=users,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
     base_dn = settings.LDAP_USER_BASE_DN
-    object_classes = [b'inetOrgPerson', b'organizationalPerson', b'person',
-                      b'top', b'posixAccount', b'ldapPublicKey']
+    object_classes = ['inetOrgPerson', 'organizationalPerson', 'person',
+                      'top', 'posixAccount', 'ldapPublicKey']
 
-    uid = CharField(db_column=b'uid', unique=True, max_length=255)
-    nick_name = CharField(db_column=b'cn', unique=True, primary_key=True,
+    uid = CharField(db_column='uid', unique=True, max_length=255)
+    nick_name = CharField(db_column='cn', unique=True, primary_key=True,
                           max_length=255)
-    first_name = CharField(db_column=b'givenName', max_length=255)
-    last_name = CharField(db_column=b'sn', max_length=255)
-    display_name = CharField(db_column=b'displayName', max_length=255,
+    first_name = CharField(db_column='givenName', max_length=255)
+    last_name = CharField(db_column='sn', max_length=255)
+    display_name = CharField(db_column='displayName', max_length=255,
                              blank=True)
-    password = CharField(db_column=b'userPassword', max_length=255)
-    uidNumber = IntegerField(db_column=b'uidNumber', unique=True)
-    gidNumber = IntegerField(db_column=b'gidNumber', default=2000)
+    password = CharField(db_column='userPassword', max_length=255)
+    uidNumber = IntegerField(db_column='uidNumber', unique=True)
+    gidNumber = IntegerField(db_column='gidNumber', default=2000)
     # Used by Sympa for logging in.
-    mail = CharField(db_column=b'mail', max_length=255, blank=True,
+    mail = CharField(db_column='mail', max_length=255, blank=True,
                      unique=True)
-    homeDirectory = CharField(db_column=b'homeDirectory', max_length=255,
+    homeDirectory = CharField(db_column='homeDirectory', max_length=255,
                               default='/tmp')
-    loginShell = CharField(db_column=b'loginShell', max_length=255,
+    loginShell = CharField(db_column='loginShell', max_length=255,
                               default='/bin/bash')
-    sshPublicKey = ListField(db_column=b'sshPublicKey', default=[])
+    sshPublicKey = ListField(db_column='sshPublicKey', default=[])
 
     def __unicode__(self):
         return self.display_name
@@ -498,11 +498,11 @@ class LdapUser(ldapdb.models.Model):
 # class LdapGroup(ldapdb.models.Model):
 # "ou=groups,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
 #     base_dn = settings.LDAP_GROUP_BASE_DN
-#     object_classes = [b'posixGroup']
+#     object_classes = ['posixGroup']
 
-#     gid = IntegerField(db_column=b'gidNumber', unique=True)
-#     name = CharField(db_column=b'cn', max_length=200, primary_key=True)
-#     members = ListField(db_column=b'memberUid')
+#     gid = IntegerField(db_column='gidNumber', unique=True)
+#     name = CharField(db_column='cn', max_length=200, primary_key=True)
+#     members = ListField(db_column='memberUid')
 
 #     def __unicode__(self):
 #         return self.name

+ 11 - 11
vpn/models.py

@@ -157,17 +157,17 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
 
 class LdapVPNConfig(ldapdb.models.Model):
     base_dn = settings.VPN_CONF_BASE_DN
-    object_classes = [b'person', b'organizationalPerson', b'inetOrgPerson',
-                      b'top', b'radiusprofile']
-
-    login = CharField(db_column=b'cn', primary_key=True, max_length=255)
-    sn = CharField(db_column=b'sn', max_length=255)
-    password = CharField(db_column=b'userPassword', max_length=255)
-    active = CharField(db_column=b'dialupAccess', max_length=3)
-    ipv4_endpoint = CharField(db_column=b'radiusFramedIPAddress', max_length=16)
-    ipv6_endpoint = CharField(db_column=b'postalAddress', max_length=40)
-    ranges_v4 = ListField(db_column=b'radiusFramedRoute')
-    ranges_v6 = ListField(db_column=b'registeredAddress')
+    object_classes = ['person', 'organizationalPerson', 'inetOrgPerson',
+                      'top', 'radiusprofile']
+
+    login = CharField(db_column='cn', primary_key=True, max_length=255)
+    sn = CharField(db_column='sn', max_length=255)
+    password = CharField(db_column='userPassword', max_length=255)
+    active = CharField(db_column='dialupAccess', max_length=3)
+    ipv4_endpoint = CharField(db_column='radiusFramedIPAddress', max_length=16)
+    ipv6_endpoint = CharField(db_column='postalAddress', max_length=40)
+    ranges_v4 = ListField(db_column='radiusFramedRoute')
+    ranges_v6 = ListField(db_column='registeredAddress')
 
     def __unicode__(self):
         return self.login