2023-09-18 15:41:41 +03:30
|
|
|
|
using Brizco.Repository.Abstracts;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Brizco.Api.Services;
|
|
|
|
|
|
|
2024-08-09 21:42:04 +03:30
|
|
|
|
public class CurrentUserService(IHttpContextAccessor httpContextAccessor) : ICurrentUserService
|
2023-09-18 15:41:41 +03:30
|
|
|
|
{
|
2024-08-09 21:42:04 +03:30
|
|
|
|
public string? UserId => httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
|
|
|
|
|
|
public string? RoleName => httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Role);
|
|
|
|
|
|
public string? UserName => httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Name);
|
|
|
|
|
|
public string? ComplexId => httpContextAccessor.HttpContext?.User?.FindFirstValue("ComplexId");
|
|
|
|
|
|
public string? RoleId => httpContextAccessor.HttpContext?.User?.FindFirstValue("RoleId");
|
|
|
|
|
|
public string? FullName => httpContextAccessor.HttpContext?.User?.FindFirstValue("FullName");
|
|
|
|
|
|
public List<string>? Permissions => httpContextAccessor.HttpContext?.User?.FindAll("Permission")?.Select(c=>c.Value)?.ToList();
|
2023-09-18 15:41:41 +03:30
|
|
|
|
}
|