1 # -*- coding: utf-8 -*-
4 # Copyright (C) 2009-2010 Bolloré telecom
5 # See AUTHORS file for a full list of contributors.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 from ldapdb.models.fields import CharField, ImageField, IntegerField, ListField
24 class LdapUser(ldapdb.models.Model):
26 Class for representing an LDAP user entry.
29 base_dn = "ou=people,dc=nodomain"
30 object_classes = ['posixAccount', 'shadowAccount', 'inetOrgPerson']
33 first_name = CharField(db_column='givenName')
34 last_name = CharField(db_column='sn')
35 full_name = CharField(db_column='cn')
36 email = CharField(db_column='mail')
37 phone = CharField(db_column='telephoneNumber', blank=True)
38 mobile_phone = CharField(db_column='mobile', blank=True)
39 photo = ImageField(db_column='jpegPhoto')
42 uid = IntegerField(db_column='uidNumber', unique=True)
43 group = IntegerField(db_column='gidNumber')
44 gecos = CharField(db_column='gecos')
45 home_directory = CharField(db_column='homeDirectory')
46 login_shell = CharField(db_column='loginShell', default='/bin/bash')
47 username = CharField(db_column='uid', primary_key=True)
48 password = CharField(db_column='userPassword')
53 def __unicode__(self):
56 class LdapGroup(ldapdb.models.Model):
58 Class for representing an LDAP group entry.
61 base_dn = "ou=groups,dc=nodomain"
62 object_classes = ['posixGroup']
64 # posixGroup attributes
65 gid = IntegerField(db_column='gidNumber', unique=True)
66 name = CharField(db_column='cn', max_length=200, primary_key=True)
67 usernames = ListField(db_column='memberUid')
72 def __unicode__(self):