backend.globaleaks.handlers.user

Module Contents

Classes

UserInstance Handler that enables users to update their own setings
UserOperationHandler

Functions

set_user_password(tid, user, password, cc)
parse_pgp_options(user, request) Used for parsing PGP key infos and fill related user configurations.
user_serialize_user(session, user, language) Serialize user model
db_get_user(session, tid, user_id) Transaction for retrieving a user model given an id
get_user(session, tid, user_id, language) Transaction for retrieving a user model given an id
db_user_update_user(session, tid, user_session, request) Transaction for updating an existing user
update_user_settings(session, tid, user_session, request, language) Transaction for updating an existing user
can_edit_general_settings_or_raise(handler) Determines if this user has ACL permissions to edit general settings
get_recovery_key(session, tid, user_id, user_cc) Transaction to get a user recovery key
enable_2fa_step1(session, tid, user_id) Transact for the first step of 2fa enrollment (start)
enable_2fa_step2(session, tid, user_id, user_cc, token) Transact for the first step of 2fa enrollment (completion)
disable_2fa(session, tid, user_id) Transaction for disabling the two factor authentication
backend.globaleaks.handlers.user.set_user_password(tid, user, password, cc)[source]
backend.globaleaks.handlers.user.parse_pgp_options(user, request)[source]

Used for parsing PGP key infos and fill related user configurations.

Parameters:
  • user – A user model
  • request – A request to be parsed
backend.globaleaks.handlers.user.user_serialize_user(session, user, language)[source]

Serialize user model

Parameters:
  • user – the user object
  • language – the language of the data
  • session – the session on which perform queries.
Returns:

a serialization of the object

backend.globaleaks.handlers.user.db_get_user(session, tid, user_id)[source]

Transaction for retrieving a user model given an id

Parameters:
  • session – An ORM session
  • tid – A tenant ID
  • user_id – A id of the user to retrieve
Returns:

A retrieved model

backend.globaleaks.handlers.user.get_user(session, tid, user_id, language)[source]

Transaction for retrieving a user model given an id

Parameters:
  • session – An ORM session
  • tid – A tenant ID
  • user_id – A id of the user to retrieve
  • language – The language to be used in the serialization
Returns:

A serialization of the retrieved user

backend.globaleaks.handlers.user.db_user_update_user(session, tid, user_session, request)[source]

Transaction for updating an existing user

Parameters:
  • session – An ORM session
  • tid – A tenant ID
  • user_session – A session of the user invoking the transaction
  • request – A user request data
Returns:

A user model

backend.globaleaks.handlers.user.update_user_settings(session, tid, user_session, request, language)[source]

Transaction for updating an existing user

Parameters:
  • session – An ORM session
  • tid – A tenant ID
  • user_session – A session of the user invoking the transaction
  • request – A user request data
  • language – A language to be used when serializing the user
Returns:

A serialization of user model

backend.globaleaks.handlers.user.can_edit_general_settings_or_raise(handler)[source]

Determines if this user has ACL permissions to edit general settings

class backend.globaleaks.handlers.user.UserInstance[source]

Bases: globaleaks.handlers.base.BaseHandler

Handler that enables users to update their own setings

check_roles = user[source]
invalidate_cache = True[source]
get(self)[source]
put(self)[source]
backend.globaleaks.handlers.user.get_recovery_key(session, tid, user_id, user_cc)[source]

Transaction to get a user recovery key

Parameters:
  • session – An ORM session
  • tid – The tenant ID
  • user_id – The user ID
  • user_cc – The user key
Returns:

The recovery key encoded base32

backend.globaleaks.handlers.user.enable_2fa_step1(session, tid, user_id)[source]

Transact for the first step of 2fa enrollment (start)

Parameters:
  • session
  • tid
  • user_id
Returns:

backend.globaleaks.handlers.user.enable_2fa_step2(session, tid, user_id, user_cc, token)[source]

Transact for the first step of 2fa enrollment (completion)

Parameters:
  • session – An ORM session
  • tid – A tenant ID
  • user_id – A user ID
  • user_cc – A user private key
  • token – A token for OTP authentication
backend.globaleaks.handlers.user.disable_2fa(session, tid, user_id)[source]

Transaction for disabling the two factor authentication

Parameters:
  • session
  • tid
  • user_id
class backend.globaleaks.handlers.user.UserOperationHandler[source]

Bases: globaleaks.handlers.operation.OperationHandler

check_roles = user[source]
get_recovery_key(self, req_args, *args, **kwargs)[source]
enable_2fa_step1(self, req_args, *args, **kwargs)[source]
enable_2fa_step2(self, req_args, *args, **kwargs)[source]
disable_2fa(self, req_args, *args, **kwargs)[source]
operation_descriptors(self)[source]