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


Python AccessAudit.get_data方法代碼示例

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


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

示例1: audited_logout

# 需要導入模塊: from auditcare.models import AccessAudit [as 別名]
# 或者: from auditcare.models.AccessAudit import get_data [as 別名]
def audited_logout (request, *args, **kwargs):
    # share some useful information
    func = auth_views.logout
    logging.info("Function: %s" %(func.__name__))
    logging.info("Logged logout for user %s" % (request.user.username))
    user = request.user
    # it's a successful login.
    ip = request.META.get('REMOTE_ADDR', '')
    ua = request.META.get('HTTP_USER_AGENT', '<unknown>')
    attempt = AccessAudit()
    attempt.doc_type=AccessAudit.__name__
    attempt.access_type = models.ACCESS_LOGOUT
    attempt.user_agent=ua
    attempt.user = user.username
    attempt.session_key = request.session.session_key
    attempt.ip_address=ip
    attempt.get_data=[]
    attempt.post_data=[]
    attempt.http_accept=request.META.get('HTTP_ACCEPT', '<unknown>')
    attempt.path_info=request.META.get('PATH_INFO', '<unknown>')
    attempt.failures_since_start=0
    attempt.save()

    # call the logout function
    response = func(request, *args, **kwargs)
    return response
開發者ID:dimagi,項目名稱:auditcare,代碼行數:28,代碼來源:views.py

示例2: decorated_logout

# 需要導入模塊: from auditcare.models import AccessAudit [as 別名]
# 或者: from auditcare.models.AccessAudit import get_data [as 別名]
    def decorated_logout (request, *args, **kwargs):
        # share some useful information
        if func.__name__ != 'decorated_logout' and VERBOSE:
            log.info('AXES: Calling decorated logout function: %s', func.__name__)
            if args: log.info('args: %s', args)
            if kwargs: log.info('kwargs: %s', kwargs)
        log.info("Function: %s", func.__name__)
        log.info("Logged logout for user %s", request.user.username)
        user = request.user
        #it's a successful login.
        ip = request.META.get('REMOTE_ADDR', '')
        ua = request.META.get('HTTP_USER_AGENT', '<unknown>')
        attempt = AccessAudit()
        attempt.doc_type=AccessAudit.__name__
        attempt.access_type = models.ACCESS_LOGOUT
        attempt.user_agent=ua
        attempt.user = user.username
        attempt.session_key = request.session.session_key
        attempt.ip_address=ip
        attempt.get_data=[] #[query2str(request.GET.items())]
        attempt.post_data=[]
        attempt.http_accept=request.META.get('HTTP_ACCEPT', '<unknown>')
        attempt.path_info=request.META.get('PATH_INFO', '<unknown>')
        attempt.failures_since_start=0
        attempt.save()

        # call the logout function
        response = func(request, *args, **kwargs)

        if func.__name__ == 'decorated_logout':
            # if we're dealing with this function itself, don't bother checking
            # for invalid login attempts.  I suppose there's a bunch of
            # recursion going on here that used to cause one failed login
            # attempt to generate 10+ failed access attempt records (with 3
            # failed attempts each supposedly)
            return response
        return response
開發者ID:,項目名稱:,代碼行數:39,代碼來源:


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