backend.globaleaks.handlers.admin.context

Module Contents

Functions

admin_serialize_context(session, context, language) Serialize the specified context
get_contexts(session, tid, language) Returns the context list.
db_associate_context_receivers(session, context, receiver_ids) Transaction for associating receivers to a context
get_context(session, tid, context_id, language) Transaction for retrieving a context serialized in the specified language
fill_context_request(tid, request, language) An utility function for correcting requests for context configuration
db_create_context(session, tid, request, language) Transaction for creating a context
create_context(session, tid, request, language) Transaction for creating a context
db_update_context(session, tid, context, request, language) Transaction for updating a context
update_context(session, tid, context_id, request, language) Transaction for updating a context
order_elements(session, tid, ids, *args, **kwargs) Transaction for reodering context elements
backend.globaleaks.handlers.admin.context.admin_serialize_context(session, context, language)[source]

Serialize the specified context

Parameters:
  • session – the session on which perform queries
  • context – The object to be serialized
  • language – the language in which to localize data.
Returns:

a dictionary representing the serialization of the context.

backend.globaleaks.handlers.admin.context.get_contexts(session, tid, language)[source]

Returns the context list.

Parameters:
  • session – An ORM session
  • tid – The tenant ID on which perform the lookup
  • language – the language in which to localize data.
Returns:

a dictionary representing the serialization of the contexts.

backend.globaleaks.handlers.admin.context.db_associate_context_receivers(session, context, receiver_ids)[source]

Transaction for associating receivers to a context

Parameters:
  • session – An ORM session
  • context – The context on which associate the specified receivers
  • receiver_ids – A list of receivers ids to be associated to the context
backend.globaleaks.handlers.admin.context.get_context(session, tid, context_id, language)[source]

Transaction for retrieving a context serialized in the specified language

Parameters:
  • session – The ORM session
  • tid – The tenant ID
  • context_id – The contaxt ID
  • language – The language to be used for the serialization
Returns:

a context descriptor serialized in the specified language

backend.globaleaks.handlers.admin.context.fill_context_request(tid, request, language)[source]

An utility function for correcting requests for context configuration

Parameters:
  • tid – The tenant ID
  • request – The request data
  • language – The language of the request
Returns:

The request data corrected in some values

backend.globaleaks.handlers.admin.context.db_create_context(session, tid, request, language)[source]

Transaction for creating a context

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • request – The request data
  • language – The request language
Returns:

The created context

backend.globaleaks.handlers.admin.context.create_context(session, tid, request, language)[source]

Transaction for creating a context

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • request – The request data
  • language – The request language
Returns:

A serialized descriptor of the context

backend.globaleaks.handlers.admin.context.db_update_context(session, tid, context, request, language)[source]

Transaction for updating a context

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • context – The object to be updated
  • request – The request data
  • language – The request language
Returns:

The updated context

backend.globaleaks.handlers.admin.context.update_context(session, tid, context_id, request, language)[source]

Transaction for updating a context

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • context_id – The ID of object to be updated
  • request – The request data
  • language – The request language
Returns:

A serialized descriptor of the context

backend.globaleaks.handlers.admin.context.order_elements(session, tid, ids, *args, **kwargs)[source]

Transaction for reodering context elements

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • ids – The ids of the contexts to be reordered
class backend.globaleaks.handlers.admin.context.ContextsCollection[source]

Bases: globaleaks.handlers.operation.OperationHandler

check_roles = admin[source]
cache_resource = True[source]
invalidate_cache = True[source]
get(self)[source]

Return all the contexts.

post(self)[source]

Create a new context.

order_elements(self, req_args, *args, **kwargs)[source]
operation_descriptors(self)[source]
class backend.globaleaks.handlers.admin.context.ContextInstance[source]

Bases: globaleaks.handlers.base.BaseHandler

check_roles = admin[source]
invalidate_cache = True[source]
put(self, context_id)[source]

Update the specified context.

delete(self, context_id)[source]

Delete the specified context.