private LoggedInUserInfoViewModel GetLoggedInUserInfo() { var userId = User.Identity.GetUserId(); var organizationId = User.Identity.GetOrganizationId(); var claimsIdentity = User.Identity as ClaimsIdentity; var user = _userManager.FindById(userId); var userInfo = new LoggedInUserInfoViewModel { HasRegistered = true, Roles = _userManager.GetRoles(userId), UserName = User.Identity.Name, UserId = userId, OrganizationName = claimsIdentity.FindFirstValue(ConstWebApi.ClaimOrganizationName), OrganizationId = claimsIdentity.FindFirstValue(ConstWebApi.ClaimOrganizationId), FullName = claimsIdentity.FindFirstValue(ClaimTypes.GivenName), Permissions = _permissionService.GetUserPermissions(userId, organizationId), Impersonated = claimsIdentity?.Claims.Any(c => c.Type == ConstWebApi.ClaimUserImpersonation && c.Value == true.ToString()) ?? false, CultureCode = user.CultureCode, TimeZone = user.TimeZone }; return(userInfo); }