コード例 #1
0
ファイル: wrapper-play.py プロジェクト: gonicus/clacks
print "Search"
print "*" * 80

for entry in ie.search(base=u"dc=gonicus,dc=de", scope=SCOPE_SUB, fltr={'sn': u'Mustermann'}, attrs=['_dn']):
    obj = ObjectProxy(entry['_dn'])
    print "* Found", obj.dn
    print "  Parent DN:", obj.get_parent_dn()
    print "  Type:", obj.get_base_type()
    print "  Extensions:", ", ".join(e for e, i in obj.get_extension_types().items() if i)
    print "  Given name:", obj.givenName
    print "  Last name:", obj.sn

# Do a modification
if 1 == 1:
    obj = ObjectProxy(u"cn=Claudia Mustermann,ou=people,dc=gonicus,dc=de")
    obj.roomNumber = "19b"
    obj.givenName = u"Günter"
    #obj.notify("Wichtige Nachricht", u"Hallo Günter - alles wird gut!")
    obj.commit()

print "*" * 80
print "Search"
print "*" * 80

for entry in ie.search(base=u"dc=gonicus,dc=de", scope=SCOPE_SUB, fltr={'sn': u'Mustermann'}, attrs=['_dn']):
    print entry['_dn']
    obj = ObjectProxy(entry['_dn'])
    print "* Found", obj.dn
    print "  Parent DN:", obj.get_parent_dn()
    print "  Type:", obj.get_base_type()
    print "  Extensions:", ", ".join(e for e, i in obj.get_extension_types().items() if i)