<tfoot id='ybgKB'></tfoot>
<legend id='ybgKB'><style id='ybgKB'><dir id='ybgKB'><q id='ybgKB'></q></dir></style></legend>
    1. <i id='ybgKB'><tr id='ybgKB'><dt id='ybgKB'><q id='ybgKB'><span id='ybgKB'><b id='ybgKB'><form id='ybgKB'><ins id='ybgKB'></ins><ul id='ybgKB'></ul><sub id='ybgKB'></sub></form><legend id='ybgKB'></legend><bdo id='ybgKB'><pre id='ybgKB'><center id='ybgKB'></center></pre></bdo></b><th id='ybgKB'></th></span></q></dt></tr></i><div id='ybgKB'><tfoot id='ybgKB'></tfoot><dl id='ybgKB'><fieldset id='ybgKB'></fieldset></dl></div>
          <bdo id='ybgKB'></bdo><ul id='ybgKB'></ul>

        <small id='ybgKB'></small><noframes id='ybgKB'>

      1. 如何检索 LDAP 数据库的所有属性

        时间:2023-07-24

          <legend id='zQHE0'><style id='zQHE0'><dir id='zQHE0'><q id='zQHE0'></q></dir></style></legend><tfoot id='zQHE0'></tfoot>
        1. <small id='zQHE0'></small><noframes id='zQHE0'>

            <bdo id='zQHE0'></bdo><ul id='zQHE0'></ul>

                  <tbody id='zQHE0'></tbody>
                • <i id='zQHE0'><tr id='zQHE0'><dt id='zQHE0'><q id='zQHE0'><span id='zQHE0'><b id='zQHE0'><form id='zQHE0'><ins id='zQHE0'></ins><ul id='zQHE0'></ul><sub id='zQHE0'></sub></form><legend id='zQHE0'></legend><bdo id='zQHE0'><pre id='zQHE0'><center id='zQHE0'></center></pre></bdo></b><th id='zQHE0'></th></span></q></dt></tr></i><div id='zQHE0'><tfoot id='zQHE0'></tfoot><dl id='zQHE0'><fieldset id='zQHE0'></fieldset></dl></div>
                  本文介绍了如何检索 LDAP 数据库的所有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 pythonldap 模块 连接到 ldap 服务器.我可以查询数据库,但我不知道如何检索数据库中存在的字段,以便我可以提前通知用户查询数据库,告诉他试图访问的字段不在数据库中.

                  I am using ldap module of python to connect to ldap server. I am able to query the database but I dont know how to retrieve the fields present in the database, so that I can notify the user in advance to quering the database, telling him that the field he is trying to access is not in the database.

                  例如,如果存在的字段只是

                  For example if the fields present are just

                  cn
                  memberOf
                  

                  如果用户尝试使用过滤器查询数据库

                  and if the user tries to query the database with filter

                  cn and memberOf and notcontained
                  

                  我应该能够知道 notcontained 属性不在 dabase 架构中.

                  I should be able to know that the notcontained attribute is not in the dabase schema.

                  我怎样才能做到这一点.

                  How can I accomplish this.

                  谢谢.

                  推荐答案

                  我正在使用 python 的 ldap 模块连接到 ldap 服务器.我能查询数据库,但我不知道如何检索字段存在于数据库中,以便我可以提前通知用户查询数据库,告诉他他正在尝试的领域访问不在数据库中.

                  I am using ldap module of python to connect to ldap server. I am able to query the database but I dont know how to retrieve the fields present in the database, so that I can notify the user in advance to quering the database, telling him that the field he is trying to access is not in the database.

                  一个简单的解决方案是搜索然后从结果中打印一个键列表.

                  A simple solution would be to search and then print a list of the keys from the result.

                  import ldap
                  
                  # connect to your ldap server
                  
                  some_dn = '...' # Your base dn
                  some_lookup = '...' # your lookup attr
                  
                  result = conn.search_s(some_dn,ldap.SCOPE_SUBTREE,some_lookup)
                  result[0][1].keys()
                  

                  例如,针对我的 AD 服务器,它返回以下内容:

                  For example, against my AD server it returns the following:

                  ['mailNickname',
                   'publicDelegatesBL',
                   'logonCount',
                   'cn',
                   'countryCode',
                   'dSCorePropagationData',
                   'objectClass',
                   # ... many many more
                  'telephoneNumber',
                  'physicalDeliveryOfficeName',
                  'name',
                  'memberOf',
                  'codePage',
                  'userAccountControl',
                  'msExchMDBRulesQuota',
                  'lastLogon',
                  'protocolSettings',
                  'uSNChanged',
                  'sn',
                  'msExchVersion',
                  'mDBUseDefaults',
                  'givenName',
                  'msExchMailboxGuid',
                  'lastLogoff']
                  

                  这篇关于如何检索 LDAP 数据库的所有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ldap3 python 搜索组成员并检索他们的 sAMAcountName (Active Directory) 下一篇:如何查找用户所属的所有组?(LDAP)

                  相关文章

                    1. <i id='S0Zin'><tr id='S0Zin'><dt id='S0Zin'><q id='S0Zin'><span id='S0Zin'><b id='S0Zin'><form id='S0Zin'><ins id='S0Zin'></ins><ul id='S0Zin'></ul><sub id='S0Zin'></sub></form><legend id='S0Zin'></legend><bdo id='S0Zin'><pre id='S0Zin'><center id='S0Zin'></center></pre></bdo></b><th id='S0Zin'></th></span></q></dt></tr></i><div id='S0Zin'><tfoot id='S0Zin'></tfoot><dl id='S0Zin'><fieldset id='S0Zin'></fieldset></dl></div>

                      <small id='S0Zin'></small><noframes id='S0Zin'>

                      <legend id='S0Zin'><style id='S0Zin'><dir id='S0Zin'><q id='S0Zin'></q></dir></style></legend><tfoot id='S0Zin'></tfoot>
                      • <bdo id='S0Zin'></bdo><ul id='S0Zin'></ul>