當前位置: 首頁>>代碼示例>>Python>>正文


Python DSAdminHarness.search_ext_s方法代碼示例

本文整理匯總了Python中bug_harness.DSAdminHarness.search_ext_s方法的典型用法代碼示例。如果您正苦於以下問題:Python DSAdminHarness.search_ext_s方法的具體用法?Python DSAdminHarness.search_ext_s怎麽用?Python DSAdminHarness.search_ext_s使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bug_harness.DSAdminHarness的用法示例。


在下文中一共展示了DSAdminHarness.search_ext_s方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Entry

# 需要導入模塊: from bug_harness import DSAdminHarness [as 別名]
# 或者: from bug_harness.DSAdminHarness import search_ext_s [as 別名]
    print "Create an AD group entry"
    groupid = ii
    groupdn = "ou=Group%d,ou=people,%s" % (groupid, suffix)                                      
    ent = Entry(groupdn)
    ent.setValues('objectclass', 'group')
    ent.setValues('groupType', '2')
    ent.setValues('objectGUID', struct.pack('B', groupid))
    ent.setValues('member', 'cn=Test User0, ou=people,' + suffix)
    ent.setValues('description', 'should not be synced to DS')
    try: ad.add_s(ent)
    except ldap.ALREADY_EXISTS: pass
    groupids.append(ii)
    ii += 1
else:
    print "Search the AD to get the entries which will be returned with the dirsync control"
    ents = ad.search_ext_s(suffix, scope, '(objectclass=user)',
                           None, 0, [DirSyncCtrl(1, 0, -1)])
    for ent in ents:
        print "Entry", ent.dn
        if not ent.userAccountControl:
            print "\thas no userAccountControl - skipping"
            continue
        val = int(ent.userAccountControl)
        if val & 0x20: # PASSWD_NOTREQD
            print "\tis marked as no password required - skipping"
            continue            
        if val & 0x200: # a normal account
            ent.setValues('nTSecurityDescriptor', '')
            if ent.isCriticalSystemObject:
                print "\tisCriticalSystemObject - skipping"
                continue
            if ent.samaccountname.startswith("SUPPORT_"):
開發者ID:axdxnco,項目名稱:scripts,代碼行數:34,代碼來源:bug476127.py


注:本文中的bug_harness.DSAdminHarness.search_ext_s方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。