rbtools.utils.users¶
Utilities for working with user sessions.
Functions
|
Return an authenticated session. |
|
Return the user resource for the current session. |
|
Return the username for the current session. |
- rbtools.utils.users.get_authenticated_session(api_client: RBClient, api_root: RootResource, auth_required: bool = False, session: Optional[Resource] = None, num_retries: int = 3, via_web: Optional[bool] = None, open_browser: bool = False, enable_logging: bool = False, capabilities: Optional[Capabilities] = None) Optional[Resource] [source]¶
Return an authenticated session.
None will be returned if the user is not authenticated, unless the ‘auth_required’ parameter is
True
, in which case the user will be prompted to login.Changed in version 5.0: Added support for authenticating through web-based login. This includes the new arguments:
via_web
,open_browser
,enable_logging
andcapabilities
.- Parameters:
api_client (
rbtools.api.client.RBClient
) – The API client of the command that is creating the server.api_root (
rbtools.api.resource.RootResource
) – The root resource for the Review Board server.auth_required (
bool
, optional) – Whether to require authenticating the user. IfTrue
, the user will be prompted to log in if they are not currently authenticated.session (
rbtools.api.resource.Resource
, optional) – The current session, if available.num_retries (
int
, optional) – The number of times to retry authenticating if it fails.via_web (
bool
, optional) –Whether to use web-based login.
New in version 5.0.
open_browser (
bool
, optional) –Whether to automatically open a browser when using web-based login.
New in version 5.0.
enable_logging (
bool
, optional) –Whether to display the logs for the web login server when using web-based login.
New in version 5.0.
capabilities (
rbtools.api.capabilities.Capabilities
, optional) –The Review Board server capabilities.
New in version 5.0.
- Returns:
The authenticated session resource or
None
if the user is not authenticated.- Return type: