Skip to main content

An LDAP database backend for Django

Project description

django-ldapdb - support for django models over LDAP
Copyright (c) 2009-2011, Bolloré Telecom
Copyright (c) 2013, Jeremy Lainé

[![Build Status](https://travis-ci.org/jlaine/django-ldapdb.png)](https://travis-ci.org/jlaine/django-ldapdb)

About
-----

_django-ldapdb_ is an LDAP database backend for Django. It allows you to
manipulate LDAP entries using Django's models. Declaring models using the
LDAP backend is very straightforward, you simply inherit from
_ldapdb.models.Model_ and declare the fields in the same way as for regular
models. You can even edit the LDAP entries using Django's admin interface.

_django-ldapdb_ requires Django version 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x,
1.7.x or 1.8.x.

_django-ldapdb_ is distributed under the BSD license, see the LICENSE
file for details. See AUTHORS file for a full list of contributors.

Using django-ldapdb
-------------------

Add the following to your _settings.py_:

DATABASES = {
...
'ldap': {
'ENGINE': 'ldapdb.backends.ldap',
'NAME': 'ldap://ldap.nodomain.org/',
'USER': 'cn=admin,dc=nodomain,dc=org',
'PASSWORD': 'some_secret_password',
}
}
DATABASE_ROUTERS = ['ldapdb.router.Router']

If you want to access posixGroup entries in your application, you can add
something like this to your _models.py_:

from ldapdb.models.fields import CharField, IntegerField, ListField
import ldapdb.models

class LdapGroup(ldapdb.models.Model):
"""
Class for representing an LDAP group entry.
"""
# LDAP meta-data
base_dn = "ou=groups,dc=nodomain,dc=org"
object_classes = ['posixGroup']

# posixGroup attributes
gid = IntegerField(db_column='gidNumber', unique=True)
name = CharField(db_column='cn', max_length=200, primary_key=True)
members = ListField(db_column='memberUid')

def __str__(self):
return self.name

def __unicode__(self):
return self.name

_Important note_ : you _must_ declare an attribute to be used as the primary
key. This attribute will play a special role, as it will be used to build the
Relative Distinguished Name of the entry. For instance in the example above,
a group whose cn is _foo_ will have the DN _cn=foo,ou=groups,dc=nodomain,dc=org_.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ldapdb-pyldap-0.4.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

django_ldapdb_pyldap-0.4.0-py2-none-any.whl (20.8 kB view details)

Uploaded Python 2

File details

Details for the file django-ldapdb-pyldap-0.4.0.tar.gz.

File metadata

File hashes

Hashes for django-ldapdb-pyldap-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8da288d385e2e5b293812012a2b411a011322cef4674630ea24cf4c1e8c0eeb4
MD5 b78b692c4519a8d90483b6cc76c6dc99
BLAKE2b-256 fc069d7414b640d52de77c0ecbead86e3cf9021ad01b6b17ab599f51c573a397

See more details on using hashes here.

File details

Details for the file django_ldapdb_pyldap-0.4.0-py2-none-any.whl.

File metadata

File hashes

Hashes for django_ldapdb_pyldap-0.4.0-py2-none-any.whl
Algorithm Hash digest
SHA256 c120a6bd22f1d68f1644f913a34d949365c643bb9c5508520936049677432173
MD5 d19eac57476d851d6d5397f61d79bf55
BLAKE2b-256 f23c2ecb15c880e8766927a04f2369b92ca9a12fa7e58e5fb20b92f35935d8ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page