Example #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from clacks.agent.objects import ObjectProxy
from clacks.agent.objects.index import ObjectIndex, SCOPE_SUB

# Do some searching
ie = ObjectIndex()

print "*" * 80
print "Create"
print "*" * 80

obj = ObjectProxy(u"ou=people,dc=gonicus,dc=de", "User")
obj.uid = "eike"
obj.sn = u"Kunst"
obj.givenName = u"Eike"
obj.commit()

print "*" * 80
print "Delete"
print "*" * 80

obj = ObjectProxy(u"cn=Eike Kunst,ou=people,dc=gonicus,dc=de")
obj.remove()

print "*" * 80
print "Extend or retract"
print "*" * 80

Example #2
0
    exit(1)

# Load scope
scope = None
if args.scope == "sub":
    scope = SCOPE_SUB
if args.scope == "one":
    scope = SCOPE_ONE
if args.scope == "base":
    scope = SCOPE_BASE
if not scope:
    print "Error: invalid scope"
    exit(1)

sys.argv = [sys.argv[0]]
ie = ObjectIndex()

# Test synchronisation
if args.sync:
    print "Please wait - updating index..."
    ie.sync_index()

start = stop = None
if args.offset and args.count:
    start = args.offset
    stop = args.ofset + args.count - 1

for e in ie.search(base=args.base, scope=scope, fltr=fltr, attrs=args.attrs,
        begin=start, end=stop):
    print e
exit(0)