本文整理汇总了Python中bug_harness.DSAdminHarness.search_s方法的典型用法代码示例。如果您正苦于以下问题:Python DSAdminHarness.search_s方法的具体用法?Python DSAdminHarness.search_s怎么用?Python DSAdminHarness.search_s使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bug_harness.DSAdminHarness
的用法示例。
在下文中一共展示了DSAdminHarness.search_s方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import search_s [as 别名]
ents = m1.search_s("cn=monitor", ldap.SCOPE_BASE, "(objectclass=*)", ["currentconnections", "connection"])
for ent in ents:
print ent
print "start search request . . ."
scope = ldap.SCOPE_SUBTREE
filter = "(|(objectclass=*)(objectclass=nsTombstone))"
serverctrls = [TestCtrl()]
ents = m1.search_s(basedn, scope, filter)
print "search returned %d entries" % len(ents)
print "send abandon with controls . . ."
m1.abandon_ext(999, serverctrls)
print "send abandon without controls . . ."
msgid2 = m1.abandon_ext(999)
print "send unbind with controls . . ."
# for some reason, unbind_ext_s is not passing
# controls passed in - so have to set_option
m1.set_option(ldap.OPT_SERVER_CONTROLS, serverctrls)
m1.unbind_ext_s(serverctrls)
print "try a search after the unbind . . ."
try:
ents = m1.search_s(basedn, scope, filter)
except ldap.LDAPError, e:
print "caught exception", e
print "open new connection . . ."
m1 = DSAdmin(host1, port1, binddn, bindpw)
print "show active connections . . ."
ents = m1.search_s("cn=monitor", ldap.SCOPE_BASE, "(objectclass=*)", ["currentconnections", "connection"])
for ent in ents:
print ent
示例2: Entry
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import search_s [as 别名]
'no_admin': True
})
#del os.environ['USE_DBX']
initfile = ''
if os.environ.has_key('SERVER_ROOT'):
initfile = "%s/slapd-%s/ldif/Example.ldif" % (m1.sroot,m1.inst)
else:
initfile = "%s/share/dirsrv/data/Example.ldif" % os.environ.get('PREFIX', '/usr')
m1.importLDIF(initfile, '', "userRoot", True)
#m1.setLogLevel(65535)
print "Add the filtered group entry with bogus filter"
dn = "cn=TestDynamicGroup,dc=example,dc=com"
ent = Entry(dn)
ent.setValues('description', "Dynamic test group")
ent.setValues('objectclass', 'top', 'groupofuniquenames', 'groupofurls')
ent.setValues('memberurl', 'ldap:///dc=example,dc=com??sub?(&(objectclass=person)(uid=scart*)')
#ent.cn = 'TestDynamicGroup'
m1.add_s(ent)
print "Add the bogus aci for that group"
addmod = [(ldap.MOD_REPLACE, 'aci', '(targetattr = "*") (version 3.0;acl "Test Crash ACL";allow (all)(groupdn = "ldap:///cn=TestDynamicGroup,dc=example,dc=com");)')]
m1.modify_s("dc=example,dc=com", addmod)
#m1.setLogLevel(0)
print "Do a search binding as a member of the group"
conn = DSAdmin(host1, port1, "uid=scarter,ou=people,dc=example,dc=com", "sprain")
entries = conn.search_s("uid=scarter,ou=people,dc=example,dc=com", ldap.SCOPE_BASE, "objectclass=*");
示例3: makeDSUserEnt
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import search_s [as 别名]
print "repl status:", ds.getReplStatus(agmtdn)
idnum = 6
ent = makeDSUserEnt()
uid = ent.uid
print "Now adding", uid, "to DS . . ."
ds.add_s(ent)
time.sleep(1)
ents = ds.search_s(suffix, scope, "(uid=%s)" % uid, attrs)
ent = ents[0]
print "Added entry to DS, adding telephonenumber . . ."
mod = [(ldap.MOD_ADD, 'telephoneNumber', telnum1)]
ds.modify_s(ent.dn, mod)
time.sleep(1)
print "Making entry a sync-able entry . . ."
mod = [(ldap.MOD_DELETE, 'telephoneNumber', telnum1),
(ldap.MOD_ADD, 'telephoneNumber', telnum2),
(ldap.MOD_ADD, 'description', 'test bug206966'),
(ldap.MOD_ADD, 'objectclass', 'ntUser'),
(ldap.MOD_ADD, 'ntUserDomainId', uid),
(ldap.MOD_ADD, 'ntUserCreateNewAccount', 'true')
]
ds.modify_s(ent.dn, mod)
time.sleep(1)
print "Now compare the entries . . ."
ents = ds.search_s(suffix, scope, "(uid=%s)" % uid)
print "DS Entry: ", str(ents[0])
ents = ad.search_s(suffix, scope, "(samaccountname=%s)" % uid)
print "AD Entry: ", str(ents[0])
示例4: Entry
# 需要导入模块: from bug_harness import DSAdminHarness [as 别名]
# 或者: from bug_harness.DSAdminHarness import search_s [as 别名]
print "Add user", ent.dn
ds.add_s(ent)
dn2 = ent.dn
dn = "cn=testgroup," + usersubtree + "," + suffix
ent = Entry(dn)
ent.setValues('objectclass', ['top', 'groupOfUniqueNames', 'ntgroup'])
ent.setValues('uniquemember', [dn1, dn2])
ent.setValues('ntUserDomainId', 'testgroup')
ent.setValues('ntGroupCreateNewGroup', 'true')
print "Add group", ent.dn
ds.add_s(ent)
print "modify", dn2
mod = [(ldap.MOD_ADD, 'description', 'a description')]
ds.modify_s(dn2, mod)
print "Wait for the magic to happen . . ."
time.sleep(5)
print "repl status:", ds.getReplStatus(agmtdn)
print "AD testuser6 entry:"
ents = ad.search_s(suffix, scope, "(samaccountname=testuser6)")
print ents[0]
print "AD testuser7 entry:"
ents = ad.search_s(suffix, scope, "(samaccountname=testuser7)")
print ents[0]
print "AD testgroup entry:"
ents = ad.search_s(suffix, scope, "(samaccountname=testgroup)")
print ents[0]