aktueller stand
This commit is contained in:
@@ -709,7 +709,10 @@ namespace C4IT.DataHistoryProvider
|
||||
{
|
||||
var relations = JsonConvert.DeserializeObject<List<cF4sdApiSearchResultRelation>>(json);
|
||||
if (relations != null)
|
||||
{
|
||||
await EnsureTicketOverviewRelationIdentitiesAsync(relations, requestInfo, LogDeep + 1, Token);
|
||||
return relations;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,6 +730,94 @@ namespace C4IT.DataHistoryProvider
|
||||
|
||||
return new List<cF4sdApiSearchResultRelation>();
|
||||
}
|
||||
|
||||
private async Task EnsureTicketOverviewRelationIdentitiesAsync(
|
||||
List<cF4sdApiSearchResultRelation> relations,
|
||||
cF4sdWebRequestInfo requestInfo,
|
||||
int logDeep,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (relations == null)
|
||||
return;
|
||||
|
||||
foreach (var relation in relations)
|
||||
{
|
||||
if (token.IsCancellationRequested || relation == null)
|
||||
return;
|
||||
|
||||
var identities = relation.Identities ?? new cF4sdIdentityList();
|
||||
relation.Identities = identities;
|
||||
|
||||
if (!identities.Any(i => i.Class == enumFasdInformationClass.Ticket) && relation.id != Guid.Empty)
|
||||
{
|
||||
identities.Add(new cF4sdIdentityEntry
|
||||
{
|
||||
Class = enumFasdInformationClass.Ticket,
|
||||
Id = relation.id
|
||||
});
|
||||
}
|
||||
|
||||
if (relation.Infos == null)
|
||||
relation.Infos = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (!relation.Infos.ContainsKey("Sids") && relation.Infos.TryGetValue("UserSid", out var userSid) && !string.IsNullOrWhiteSpace(userSid))
|
||||
relation.Infos["Sids"] = userSid;
|
||||
|
||||
Guid userId = Guid.Empty;
|
||||
if (relation.Infos.Count > 0)
|
||||
{
|
||||
if (relation.Infos.TryGetValue("Sids", out var sidsValue))
|
||||
{
|
||||
var sids = sidsValue?.Split(',')
|
||||
.Select(v => v.Trim())
|
||||
.Where(v => !string.IsNullOrWhiteSpace(v))
|
||||
.ToList();
|
||||
|
||||
if (sids != null && sids.Count > 0)
|
||||
{
|
||||
var resolved = await Collector.UserSearchBySidsAsync(sids, token, requestInfo, logDeep + 1);
|
||||
var user = resolved?.Values?.FirstOrDefault()?.FirstOrDefault();
|
||||
if (user?.Result != null)
|
||||
userId = user.Result.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (userId == Guid.Empty && relation.Infos.TryGetValue("UserAccount", out var userAccount))
|
||||
{
|
||||
relation.Infos.TryGetValue("UserDomain", out var userDomain);
|
||||
if (!string.IsNullOrWhiteSpace(userAccount))
|
||||
{
|
||||
var resolved = await Collector.GetUserIdFromAccountAsync(userAccount, userDomain, requestInfo, logDeep + 1, token);
|
||||
if (resolved.HasValue)
|
||||
userId = resolved.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (userId == Guid.Empty)
|
||||
{
|
||||
if (relation.Infos.TryGetValue("UserId", out var userIdString) ||
|
||||
relation.Infos.TryGetValue("UserGuid", out userIdString) ||
|
||||
relation.Infos.TryGetValue("UserIdentityId", out userIdString))
|
||||
{
|
||||
Guid.TryParse(userIdString, out userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userId == Guid.Empty)
|
||||
continue;
|
||||
|
||||
identities.RemoveAll(i => i.Class == enumFasdInformationClass.User);
|
||||
identities.Add(new cF4sdIdentityEntry
|
||||
{
|
||||
Class = enumFasdInformationClass.User,
|
||||
Id = userId
|
||||
});
|
||||
|
||||
relation.Infos["UserId"] = userId.ToString();
|
||||
relation.Infos["UserGuid"] = userId.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<List<cF4SDHealthCardRawData.cHealthCardTable>> GetTableResultsVirtualAsync(List<cDataHistoryConfigTable> Tables, Dictionary<enumFasdInformationClass, cF4sdConnectorIds> Identities, DateTime RefTime, int MaxAge, bool instantly, Guid? CacheId, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
|
||||
{
|
||||
@@ -2669,7 +2760,7 @@ namespace C4IT.DataHistoryProvider
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
//await Collector.ReportTicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
await Collector.ReportTicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -2918,7 +3009,7 @@ namespace C4IT.DataHistoryProvider
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
//await Collector.ReportTicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
await Collector.ReportTicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user