File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
validation_service_api/validation_service/resources Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 44from fastapi .security import HTTPBearer , HTTPAuthorizationCredentials
55from starlette .requests import Request
66from httpx import HTTPStatusError
7- from ..auth import oauth , User
7+ from ..auth import oauth , User , get_kg_client_for_user_account
88from ..settings import BASE_URL
9+ from ..data_models import Person
910
1011
1112router = APIRouter ()
@@ -88,3 +89,19 @@ async def list_projects(
8889 return [p for p in projects if p ["permissions" ]["UPDATE" ]]
8990 else :
9091 return projects
92+
93+ @router .get ("/me" )
94+ async def get_person (
95+ request : Request ,
96+ token : HTTPAuthorizationCredentials = Depends (auth ),
97+ ):
98+ kg_user_client = get_kg_client_for_user_account (token )
99+ user = User (token , allow_anonymous = False )
100+ kg_person = await user .get_person (kg_user_client )
101+ if kg_person :
102+ return Person .from_kg_object (kg_person , kg_user_client )
103+ else :
104+ raise HTTPException (
105+ status_code = status .HTTP_404_NOT_FOUND ,
106+ detail = "There is no Knowledge Graph entry for this user. Please contact support."
107+ )
You can’t perform that action at this time.
0 commit comments