Пример #1
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     if not Authenticator.is_authenticated(handler.request.path, handler.request.method, helper):
         helper.header(error_header, error_message)
         helper.error(403)
     else:
         f(*args, **kw)
Пример #2
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     if not users.is_current_user_admin():
         helper.header(error_header, error_msg)
         helper.error(403)
     else:
         f(*args, **kw)
Пример #3
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     if not users.is_current_user_admin():
         helper.header(error_header, error_msg)
         helper.error(403)
     else:
         f(*args, **kw)
Пример #4
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     if not Authenticator.is_authenticated(
             handler.request.path, handler.request.method, helper):
         helper.header(error_header, error_message)
         helper.error(403)
     else:
         f(*args, **kw)
Пример #5
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     user = users.get_current_user()
     if not user:
         helper.header(error_header, error_msg)
         helper.error(403)
     elif not emails or (not user.email() in emails):
         helper.header(error_header, "unauthorized-user")
         helper.error(403)
     else:
         f(*args, **kw)
Пример #6
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     user = users.get_current_user()
     if not user:
         helper.header(error_header, error_msg)
         helper.error(403)
     elif not emails or (not user.email() in emails):
         helper.header(error_header, "unauthorized-user")
         helper.error(403)
     else:
         f(*args, **kw)
Пример #7
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     auth_header = handler.request.headers.get(Headers.AUTHORIZATION, "")
     code, headers, user = DigestAuth(realm, users).authenticate(handler.request.method, 
         handler.request.path,
         auth_header)
     if code >= 400 and code < 499:
         for k, v in headers:
             helper.header(k, v)
         helper.error(code)
     else:
         kw['username'] = user
         return f(*args, **kw)
Пример #8
0
 def args_call(*args, **kw):
     handler = args[0]
     helper = RequestHelper(handler)
     auth_header = handler.request.headers.get(Headers.AUTHORIZATION,
                                               "")
     code, headers, user = DigestAuth(realm, users).authenticate(
         handler.request.method, handler.request.path, auth_header)
     if code >= 400 and code < 499:
         for k, v in headers:
             helper.header(k, v)
         helper.error(code)
     else:
         kw['username'] = user
         return f(*args, **kw)