示例#1
0
    def decorated_view(*args, **kwargs):
        slog = (
            request.method,
            current_user.id,
            current_user.nickname,
            time.strftime("%Y-%m-%d %X", time.localtime()),
            request,
            request.form,
        )
        logging.error(slog)
        print slog
        clog = cache.get("johnlog")
        if not clog:
            print "99999999999999"
            cache.set("johnlog", slog)

        slog = cache.get("johnlog")
        print slog

        if not current_user.is_authenticated():
            return current_app.login_manager.unauthorized()
        if current_user.action(fn.__name__):
            return fn(*args, **kwargs)
        if request.is_xhr:
            return jsonify(result=False, error=u"权限不1足")
        abort(403)
示例#2
0
 def decorated_view(*args, **kwargs):
     slog = request.method,current_user.id,current_user.nickname,time.strftime("%Y-%m-%d %X", time.localtime()),request,request.form
     logging.error(slog)
     print slog
     clog = cache.get('johnlog')
     if not clog:
         print '99999999999999'
         cache.set('johnlog',slog)
     
     slog = cache.get('johnlog')
     print slog
     
     if not current_user.is_authenticated():
         return current_app.login_manager.unauthorized()
     if current_user.action(fn.__name__):
         return fn(*args, **kwargs)
     if request.is_xhr:return jsonify(result=False,error=u'权限不1足')
     abort(403)
示例#3
0
 def is_authorize(endpoint):
     return current_user.action(endpoint.rsplit('.',1)[1])