public async Task WriteAudit(AuditMessage message) { foreach (var builder in _builders) { builder.Build(message); } await _client.Audit(message); }
public async Task WriteAudit(EmployerUsersAuditMessage message) { var auditMessage = _messageFactory.Build(); auditMessage.AffectedEntity = message.AffectedEntity; auditMessage.Category = message.Category; auditMessage.Description = message.Description; auditMessage.ChangedProperties = message.ChangedProperties; auditMessage.RelatedEntities = message.RelatedEntities; await _client.Audit(auditMessage); }
public async Task SendAuditMessage(EasAuditMessage message) { try { var auditMessage = _factory.Build(); auditMessage.Category = message.Category; auditMessage.Description = message.Description; auditMessage.ChangedProperties = message.ChangedProperties; auditMessage.RelatedEntities = message.RelatedEntities; auditMessage.AffectedEntity = message.AffectedEntity; await _auditApiClient.Audit(auditMessage); } catch (Exception exception) { _logger.Error(exception, "An error occurred when calling the audit service."); } }
public Task Audit(AuditMessage message) { if (_userContext.IsSupportConsoleUser()) { var impersonatedUser = _userContext.GetClaimValue(DasClaimTypes.Id); var impersonatedUserEmail = _userContext.GetClaimValue(DasClaimTypes.Email); message.ChangedBy.Id = _userContext.GetClaimValue(ClaimTypes.Upn); // support user user principal name message.ChangedBy.EmailAddress = _userContext.GetClaimValue(ClaimTypes.Email); // support user Email if (message.RelatedEntities == null) { message.RelatedEntities = new List <Entity>(); } message.RelatedEntities.Add(new Entity { Type = "UserImpersonatedId", Id = impersonatedUser }); message.RelatedEntities.Add(new Entity { Type = "UserImpersonatedEmail", Id = impersonatedUserEmail }); } return(_client.Audit(message)); }