tahrir.utils.user module

class tahrir.utils.user.User(ext)[source]

Bases: User

property awarded_assertions
property email

The user’s email.

property is_admin
property logged_in

Return True if the user is logged in, False otherwise.

property person
reset_cache()[source]
tahrir.utils.user.create_person(nickname: str, email: str) tahrir_api.model.Person[source]
tahrir.utils.user.get_awarded_assertions(username)[source]
tahrir.utils.user.get_person(id_or_nickname)[source]

Attempt to get a user by their id or nickname, returning None if we fail.

tahrir.utils.user.get_user_badge_info(user)[source]

Returns a dictionary of the user badge information with serialized badges

tahrir.utils.user.need_access_root(view_func)[source]
tahrir.utils.user.need_access_user(view_func)[source]
tahrir.utils.user.on_authorized(sender, **kwargs)[source]
tahrir.utils.user.require_admin(view_func)[source]

Use this to decorate view functions that require a user to be logged in. This assumes the user is already logged-in.

Added in version 1.0: This was check() before.

tahrir.utils.user.require_login(view_func)[source]

Use this to decorate view functions that require a user to be logged in. If the user is not already logged in, they will be sent to the Provider to log in, after which they will be returned.

Added in version 1.0: This was check() before.