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


Python Auth.get_entry_attribute方法代碼示例

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


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

示例1: Auth

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import get_entry_attribute [as 別名]
                                continue
                        else:
                            if not '/'.join(folder.split('/')[0]) == 'shared':
                                log.info(_("Deleting mailbox '%s' because it has no recipients") % (folder))
                                try:
                                    imap.dm(folder)
                                except Exception, errmsg:
                                    log.error(_("An error occurred removing mailbox %r: %r") % (folder, errmsg))
                            else:
                                log.info(_("Not automatically deleting shared folder '%s'") % (folder))
                    else:
                        log.warning(_("No recipients for '%s' (use --delete to delete)!") % ('/'.join(folder.split('/')[1:])))

                    continue
            else:
                mailhost = auth.get_entry_attribute(primary, recipient, 'mailhost')

            if not server == mailhost:
                if conf.dry_run:
                    print folder, server, mailhost
                else:
                    auth.set_entry_attribute(primary, recipient, 'mailhost', server)

    folders = []
    folders.extend(imap.lm("shared/%%"))
    folders.extend(imap.lm("user/%%"))

    auth = Auth()
    auth.connect()

    for folder in folders:
開發者ID:tpokorra,項目名稱:pykolab,代碼行數:33,代碼來源:cmd_sync_mailhost_attrs.py

示例2: PolicyRequest

# 需要導入模塊: from pykolab.auth import Auth [as 別名]
# 或者: from pykolab.auth.Auth import get_entry_attribute [as 別名]

#.........這裏部分代碼省略.........
            recipient = {
                    'dn': recipients
                }

        # We have gotten an invalid recipient. We need to catch this case,
        # because testing can input invalid recipients, and so can faulty
        # applications, or misconfigured servers.
        if not recipient['dn']:
            if not conf.allow_unauthenticated:
                cache_update(
                        function='verify_recipient',
                        sender=self.sender,
                        recipient=recipient,
                        result=(int)(False),
                        sasl_username=self.sasl_username,
                        sasl_sender=self.sasl_sender
                    )

                reject(_("Invalid recipient"))
            else:
                cache_update(
                        function='verify_recipient',
                        sender=self.sender,
                        recipient=recipient,
                        result=(int)(True),
                        sasl_username=self.sasl_username,
                        sasl_sender=self.sasl_sender
                    )

                log.debug(_("Could not find this user, accepting"), level=8)
                return True

        if not recipient['dn'] == False:
            recipient_policy = self.auth.get_entry_attribute(
                    sasl_domain,
                    recipient,
                    'kolabAllowSMTPSender'
                )

        # If no such attribute has been specified, allow
        if recipient_policy == None:
            recipient_verified = True

        # Otherwise, parse the policy obtained with the subject of the policy
        # being the recipient, and the object to apply the policy to being the
        # sender.
        else:
            recipient_verified = self.parse_policy(
                    recipient,
                    self.sender,
                    recipient_policy
                )

            cache_update(
                    function='verify_recipient',
                    sender=self.sender,
                    recipient=recipient,
                    result=(int)(recipient_verified),
                    sasl_username=self.sasl_username,
                    sasl_sender=self.sasl_sender
                )

        return recipient_verified

    def verify_recipients(self):
        """
開發者ID:detrout,項目名稱:pykolab,代碼行數:70,代碼來源:kolab_smtp_access_policy.py


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