guards#

Guards for the accounts domain.

app.domain.accounts.guards.requires_superuser(connection: ASGIConnection, _: BaseRouteHandler) None[source]#

Request requires active superuser.

Parameters:
  • connection (ASGIConnection) – HTTP Request

  • _ (BaseRouteHandler) – Route handler

Raises:

PermissionDeniedException – Permission denied exception

Returns:

Returns None when successful

Return type:

None

app.domain.accounts.guards.requires_active_user(connection: ASGIConnection, _: BaseRouteHandler) None[source]#

Request requires active user.

Verifies the request user is active.

Parameters:
  • connection (ASGIConnection) – HTTP Request

  • _ (BaseRouteHandler) – Route handler

Raises:

PermissionDeniedException – Permission denied exception

app.domain.accounts.guards.requires_verified_user(connection: ASGIConnection, _: BaseRouteHandler) None[source]#

Verify the connection user is a superuser.

Parameters:
  • connection (ASGIConnection) – Request/Connection object.

  • _ (BaseRouteHandler) – Route handler.

Raises:

PermissionDeniedException – Not authorized

Returns:

Returns None when successful

Return type:

None

async app.domain.accounts.guards.current_user_from_token(token: Token, connection: ASGIConnection[Any, Any, Any, Any]) User | None[source]#

Lookup current user from local JWT token.

Fetches the user information from the database

Parameters:
  • token (str) – JWT Token Object

  • connection (ASGIConnection[Any, Any, Any, Any]) – ASGI connection.

Returns:

User record mapped to the JWT identifier

Return type:

User