Add TokenUserInfo class and extend ClaimsPrincipal with methods for user claims retrieval
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m49s

This commit is contained in:
Suphonchai Phoonsawat 2026-03-17 15:47:03 +07:00
parent b1df33dc20
commit 7e0f0485fd
5 changed files with 201 additions and 12 deletions

View file

@ -144,7 +144,13 @@ namespace BMA.EHR.Leave.Service.Controllers
{
get
{
if (UserId != null || UserId != "")
// First try to get from claims
var ocIdFromClaims = OrgRootDnaId;
if (ocIdFromClaims.HasValue && ocIdFromClaims.Value != Guid.Empty)
return ocIdFromClaims.Value;
// Fallback to API call for backward compatibility
if (UserId != null && UserId != "")
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!), AccessToken);
else
return Guid.Empty;