backend.globaleaks.handlers.base

Module Contents

Classes

BaseHandler

Functions

serve_file(request, fo)
connection_check(tid, client_ip, role, client_using_tor) Accept or refuse a connection in relation to the platform settings
backend.globaleaks.handlers.base.serve_file(request, fo)[source]
backend.globaleaks.handlers.base.connection_check(tid, client_ip, role, client_using_tor)[source]

Accept or refuse a connection in relation to the platform settings

Parameters:
  • tid – A tenant ID
  • client_ip – A client IP
  • role – A user role
  • client_using_tor – A boolean for signaling Tor use
class backend.globaleaks.handlers.base.BaseHandler(state, request)[source]

Bases: object

check_roles = admin[source]
handler_exec_time_threshold = 120[source]
uniform_answer_time = False[source]
cache_resource = False[source]
invalidate_cache = False[source]
root_tenant_only = False[source]
upload_handler = False[source]
uploaded_file[source]
refresh_connection_endpoints = False[source]
current_user[source]
static validate_python_type(value, python_type)[source]

Return True if the python class instantiates the specified python_type.

static validate_regexp(value, type)[source]

Return True if the python class matches the given regexp.

static validate_type(value, type)[source]
static validate_jmessage(jmessage, message_template)[source]

Takes a string that represents a JSON messages and checks to see if it conforms to the message type it is supposed to be.

This message must be either a dict or a list. This function may be called recursively to validate sub-parameters that are also go GLType.

static validate_message(message, message_template)[source]
redirect(self, url)[source]
check_file_presence(self, filepath)[source]
open_file(self, filepath)[source]
write_file(self, filename, fp)[source]
write_file_as_download(self, filename, fp)[source]
get_current_user(self)[source]
get_api_session(self)[source]
process_file_upload(self)[source]
write_upload_plaintext_to_disk(self, destination)[source]
Parameters:destination – the path where to store the file
Returns:a descriptor dictionary for the saved file
execution_check(self)[source]