credentials do hlavicky + crypto + docu
This commit is contained in:
+10
-10
@@ -2,17 +2,17 @@ from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Query, Response, status
|
||||
|
||||
from .config import settings
|
||||
from .config import Settings
|
||||
from .credentials import get_request_settings
|
||||
from .graph_client import MicrosoftGraphClient
|
||||
from .schemas import CalendarEventRequest, DriveUploadRequest, SendMailRequest
|
||||
from .services import CalendarService, DriveService, GroupsService, MailService, UsersService
|
||||
|
||||
router = APIRouter(tags=["microsoft365"])
|
||||
graph_client = MicrosoftGraphClient(settings)
|
||||
|
||||
|
||||
def get_graph_client() -> MicrosoftGraphClient:
|
||||
return graph_client
|
||||
def get_graph_client(request_settings: Settings = Depends(get_request_settings)) -> MicrosoftGraphClient:
|
||||
return MicrosoftGraphClient(request_settings)
|
||||
|
||||
|
||||
def get_users_service(graph: MicrosoftGraphClient = Depends(get_graph_client)) -> UsersService:
|
||||
@@ -36,13 +36,13 @@ def get_groups_service(graph: MicrosoftGraphClient = Depends(get_graph_client))
|
||||
|
||||
|
||||
@router.get("/status")
|
||||
def microsoft365_status() -> dict[str, Any]:
|
||||
def microsoft365_status(request_settings: Settings = Depends(get_request_settings)) -> dict[str, Any]:
|
||||
return {
|
||||
"configured": settings.is_configured,
|
||||
"tenant_id": bool(settings.tenant_id),
|
||||
"client_id": bool(settings.client_id),
|
||||
"client_secret": bool(settings.client_secret),
|
||||
"graph_base_url": settings.graph_base_url,
|
||||
"configured": request_settings.is_configured,
|
||||
"tenant_id": bool(request_settings.tenant_id),
|
||||
"client_id": bool(request_settings.client_id),
|
||||
"client_secret": bool(request_settings.client_secret),
|
||||
"graph_base_url": request_settings.graph_base_url,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user