server.web.routes.utils
Attributes
Classes
dict() -> new empty dictionary |
Functions
|
to_user_dict. |
|
get_user. |
|
get_request_username. |
|
user_in_group. |
|
is_super_user. |
|
Check if authentication is enabled. |
|
Create an anonymous user for unauthenticated mode. |
|
Get user or return anonymous user when auth is disabled. |
Module Contents
- class server.web.routes.utils.User[source]
Bases:
typing_extensions.TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- server.web.routes.utils.to_user_dict(data: Mapping[str, Any]) User[source]
to_user_dict.
Converts dict to User TypedDict.
- server.web.routes.utils.get_user(request: starlette.requests.Request) User[source]
get_user.
A shared function to get the user from the session. Make it a method to mock in testing.
- server.web.routes.utils.get_request_username(request: starlette.requests.Request) str[source]
get_request_username.
Returns the username part of the email address from the request.
- server.web.routes.utils.user_in_group(request: starlette.requests.Request, group: str) bool[source]
user_in_group.
Check is a user is a member of the specified group.
- server.web.routes.utils.is_super_user(user: User) bool[source]
is_super_user.
Checks if a user is a member of the superuser group defined in the OIDC__ADMIN_GROUP configuration option.