view MoinMoin/_tests/ldap_testdata.py @ 6028:1893da1d5213

userid lookup caches: use 1 on-disk cache file, update cache rather than rebuild Before this, we maintained one cache file per attribute (e.g. name2id, openid2id, ...) - the related code did multiple passes over all user profiles to rebuild these cache files. Now doing a one-pass rebuild, writing all attribute -> userid mappings into one on-disk cache file called "lookup". Additionally to "name" and "openids", support fast lookup for "email" and "jid" also. On profile save, we use to just kill the cache and let it rebuild. Now the cache is read, updated and written back (which is much less expensive for wikis with more than a few users). Did some refactoring also, reducing duplication, breaking down the code into smaller functions / methods.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 18:22:10 +0100
parents b8ea98d74d8d
children
line wrap: on
line source

BASEDN = "ou=testing,dc=example,dc=org"
ROOTDN = "cn=root,%s" % BASEDN
ROOTPW = "secret"

SLAPD_CONFIG = """\
# See slapd.conf(5) for details on configuration options.

include		%(schema_dir)s/core.schema
include		%(schema_dir)s/cosine.schema
include		%(schema_dir)s/inetorgperson.schema
#include	%(schema_dir)s/misc.schema

moduleload	back_bdb.la

threads 2

# Global access control ###############################################

# Root DSE: allow anyone to read it
access to dn.base="" by * read
# Subschema (sub)entry DSE: allow anyone to read it
access to dn.base="cn=Subschema" by * read

# we don't need restrictive ACLs for tests:
access to * by * read

allow bind_anon_dn

# Test-Datenbank ou=testing,dc=example,dc=org ################

database	bdb

directory	%(ldap_db_dir)s
suffix		"%(basedn)s"
rootdn		"%(rootdn)s"
rootpw		%(rootpw)s
lastmod		on

index 		uid eq

checkpoint 200 5

# Entries to cache in memory
cachesize 500
# Search results to cache in memory
idlcachesize 50

sizelimit	-1
"""

LDIF_CONTENT = """\
########################################################################
# regression testing
########################################################################
version: 1

dn: ou=testing,dc=example,dc=org
objectClass: organizationalUnit
ou: testing

dn: ou=Groups,ou=testing,dc=example,dc=org
objectClass: organizationalUnit
ou: Groups

dn: ou=Users,ou=testing,dc=example,dc=org
objectClass: organizationalUnit
ou: Users

dn: ou=Unit A,ou=Users,ou=testing,dc=example,dc=org
objectClass: organizationalUnit
ou: Unit A

dn: ou=Unit B,ou=Users,ou=testing,dc=example,dc=org
objectClass: organizationalUnit
ou: Unit B

dn: uid=usera,ou=Unit A,ou=Users,ou=testing,dc=example,dc=org
objectClass: account
objectClass: simpleSecurityObject
uid: usera
# this is md5 encoded 'usera' for password
userPassword: {MD5}aXqgOSc5gSW7YoLi9BSmvg==

dn: uid=userb,ou=Unit B,ou=Users,ou=testing,dc=example,dc=org
cn: Vorname Nachname
objectClass: inetOrgPerson
sn: Nachname
uid: userb
# this is md5 encoded 'userb' for password
userPassword: {MD5}ThvfQsM7OQFjqSUQOX2XsA==

dn: cn=Group A,ou=Groups,ou=testing,dc=example,dc=org
cn: Group A
member: cn=dummy
member: uid=usera,ou=Unit A,ou=Users,ou=testing,dc=example,dc=org
objectClass: groupOfNames

dn: cn=Group B,ou=Groups,ou=testing,dc=example,dc=org
cn: Group B
objectClass: groupOfUniqueNames
uniqueMember: cn=dummy
uniqueMember: uid=userb,ou=Unit B,ou=Users,ou=testing,dc=example,dc=org

dn: cn=Group C,ou=Groups,ou=testing,dc=example,dc=org
cn: Group C
description: Nested group!
member: cn=dummy
member: cn=Group A,ou=Groups,ou=testing,dc=example,dc=org
objectClass: groupOfNames
"""