feat: Enhance network membership and withdrawal processing with user tracking and logging
This commit is contained in:
@@ -14,4 +14,19 @@ public class CurrentUserService : ICurrentUserService
|
||||
}
|
||||
|
||||
public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
public string? Username => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Name)
|
||||
?? _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Email);
|
||||
|
||||
public bool IsAuthenticated => _httpContextAccessor.HttpContext?.User?.Identity?.IsAuthenticated ?? false;
|
||||
|
||||
public string GetPerformedBy()
|
||||
{
|
||||
if (!IsAuthenticated || string.IsNullOrEmpty(UserId))
|
||||
return "System";
|
||||
|
||||
return string.IsNullOrEmpty(Username)
|
||||
? $"User:{UserId}"
|
||||
: $"{UserId}:{Username}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user