Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
property Session.ready : bool
Whether the session is ready or not.
When False, the server will reject most requests made by users without the ROLE_ADMIN role with an HTTP 503 Service Unavailable status.
This can be used to prevent queries from being made on a session that has not yet finished its initial setup process (tables and cubes creation, data loading, etc).
This property has no impact in the community edition since the ROLE_ADMIN role is always granted.
Example
>>> admin_auth = "admin", "passwd"
>>> user_auth = "user", "passwd"
>>> session_config = tt.SessionConfig(
... ready=False, security=tt.SecurityConfig()
... )
>>> session = tt.Session.start(session_config)
>>> session.ready
False
>>> for (username, password), roles in {
... admin_auth: {"ROLE_ADMIN"},
... user_auth: {"ROLE_USER"},
... }.items():
... session.security.individual_roles[username] = roles
... session.security.basic_authentication.credentials[username] = (
... password
... )
The session starts as not ready so only admins can access it:
>>> import httpx
>>> ping_path = f"{session.client.get_path_and_version_id('activeviam/pivot')[0]}/ping"
>>> url = f"{session.url}/{ping_path}"
>>> httpx.get(url, auth=admin_auth).status_code
200
>>> httpx.get(url, auth=user_auth).status_code
503
Making the session available to all users:
>>> session.ready = True
>>> session.ready
True
>>> httpx.get(url, auth=admin_auth).status_code
200
>>> httpx.get(url, auth=user_auth).status_code
200
Making the session unavailable to non-admins again:
>>> session.ready = False
>>> session.ready
False
>>> httpx.get(url, auth=admin_auth).status_code
200
>>> httpx.get(url, auth=user_auth).status_code
503