Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

CurrentUserService

Class to manage the current connected user with pluggable storage.

Use to set and get the user in a session. The storage mechanism is determined by the initialized loader (HTTP, Streamlit, Reflex, etc.).

Functions
check_is_admin @classmethod
check_is_sysuser @classmethod
clear_auth_context @classmethod

Clear the auth context in the current session

get_and_check_current_user @classmethod

Get the user in the current session, throw an exception if the user does not exists

Return type : User
get_auth_context @classmethod

Get the auth context in the current session, return none if not exists

Return type : gws_core.user.auth_context.AuthContextBase | None
get_current_user @classmethod

Get the user in the current session, return none if the user is not authenticated

Return type : gws_core.user.user.User | None
get_current_user_theme @classmethod
Return type : FrontTheme
initialize_loader @classmethod

Initialize the auth context loader for the application. Must be called at app startup (Streamlit, Reflex, etc.)

Args: loader: The loader implementation to use context: The context type (APP, REFLEX, etc.)

loader : AuthContextLoader
is_initialized @classmethod

Check if the CurrentUserService has been initialized with a loader.

Return type : bool
set_auth_context @classmethod

Set the auth context in the current session

auth_context : AuthContextBase
set_auth_user @classmethod

Set the user in the current session

user : User
Return type : AuthContextUser
set_current_user_from_share_auth @classmethod

Set the user in the current session from a share authentication

user_is_authenticated @classmethod

Check if the user is authenticated

Return type : bool
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.