(20241213) Started accepting "auth" for software/theCaOfficeAi... I don't know how these details count as "auth", though.
This commit is contained in:
@@ -81,6 +81,9 @@ import asyncio
|
||||
# To work with date and time:
|
||||
import datetime
|
||||
|
||||
# Helpers:
|
||||
from api.helpers.user import token_check
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
# ***** ****
|
||||
@@ -161,17 +164,20 @@ async def list_mails(
|
||||
"""
|
||||
|
||||
# If the session token is invalid/expired:
|
||||
if kwargs.get("session_info") is None:
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.FAILED,
|
||||
http_code = HttpCodes.UNAUTHORIZED
|
||||
)
|
||||
if await token_check.is_not_authorized(
|
||||
mongo_conn = current_app.data_mongo,
|
||||
user_info = kwargs.get("session_info"),
|
||||
token_ids = inbound_data.tokenIds
|
||||
): return ResponseModel(
|
||||
status_code = StatusCodes.FAILED,
|
||||
http_code = HttpCodes.UNAUTHORIZED,
|
||||
message = "user not authorized to use this token"
|
||||
)
|
||||
|
||||
# Build the additional filter:
|
||||
additional_filter = {}
|
||||
if inbound_data.tags: additional_filter["tags"] = {"$in": inbound_data.tags}
|
||||
additional_filter = additional_filter or None
|
||||
print("AddFil:", additional_filter)
|
||||
|
||||
# Get the mails:
|
||||
mails_list = await current_app.mail_controller.list_mails(
|
||||
|
||||
Reference in New Issue
Block a user