Skip to content

Instantly share code, notes, and snippets.

@felipe-prenholato
Created March 21, 2011 19:08
Show Gist options
  • Save felipe-prenholato/880004 to your computer and use it in GitHub Desktop.
Save felipe-prenholato/880004 to your computer and use it in GitHub Desktop.
# coding: utf-8
from ldapdb.models.fields import CharField, ImageField, IntegerField, ListField
import ldapdb.models
class LdapUser(ldapdb.models.Model):
"""
Class for representing an LDAP user entry.
"""
# LDAP meta-data
base_dn = "dc=goldfarb,dc=corp"
object_classes = ['user']
username = CharField(db_column='sAMAccountName',unique=True)
first_name = CharField(db_column='givenName')
last_name = CharField(db_column='sn')
full_name = CharField(db_column='cn')
email = CharField(db_column='mail')
def __unicode__(self):
return u"%s (%s)" % (self.full_name,self.username)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment