Updated get user object

This commit is contained in:
Scott Idem
2021-05-07 16:59:30 -04:00
parent e3186ddc60
commit 8cbabf48fe
3 changed files with 14 additions and 11 deletions

View File

@@ -559,10 +559,11 @@ async def lookup_username(
return mk_resp(data=data)
@router.get('/{obj_id}', response_model=Resp_Body_Base)
@router.get('/{user_id}', response_model=Resp_Body_Base)
async def get_user_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
user_id: str = Query(..., min_length=1, max_length=22),
x_account_id: str = Header(...),
inc_roles: bool = False,
inc_contact: bool = False,
inc_organization: bool = False,
inc_person: bool = False,
@@ -572,14 +573,15 @@ async def get_user_obj(
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
obj_type = 'user'
result = get_obj_template(
obj_type=obj_type,
obj_id=obj_id,
by_alias=True,
exclude_unset=True,
)
return result
user_obj = load_user_obj(
user_id=user_id,
inc_roles=inc_roles,
inc_contact=inc_contact,
inc_organization=inc_organization,
inc_person=inc_person
).dict(by_alias=by_alias, exclude_unset=exclude_unset)
data = user_obj
return mk_resp(data=data)
@router.delete('/{obj_id}', response_model=Resp_Body_Base)