removed commented code and show current alias for ip search
This commit is contained in:
parent
1f8b7cde3f
commit
c7fab5d36c
@ -40,19 +40,19 @@ namespace IW4MAdmin.Application.Meta
|
|||||||
|
|
||||||
var linkId = await ctx.Clients.AsNoTracking()
|
var linkId = await ctx.Clients.AsNoTracking()
|
||||||
.Where(_client => _client.ClientId == query.ClientId)
|
.Where(_client => _client.ClientId == query.ClientId)
|
||||||
.Select(_client => _client.AliasLinkId)
|
.Select(_client => new {_client.AliasLinkId, _client.CurrentAliasId })
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
var iqPenalties = ctx.Penalties.AsNoTracking()
|
var iqPenalties = ctx.Penalties.AsNoTracking()
|
||||||
.Where(_penalty => _penalty.OffenderId == query.ClientId ||
|
.Where(_penalty => _penalty.OffenderId == query.ClientId ||
|
||||||
linkedPenaltyType.Contains(_penalty.Type) && _penalty.LinkId == linkId);
|
linkedPenaltyType.Contains(_penalty.Type) && _penalty.LinkId == linkId.AliasLinkId);
|
||||||
|
|
||||||
var iqIpLinkedPenalties = new List<EFPenalty>().AsQueryable();
|
var iqIpLinkedPenalties = new List<EFPenalty>().AsQueryable();
|
||||||
|
|
||||||
if (!_appConfig.EnableImplicitAccountLinking)
|
if (!_appConfig.EnableImplicitAccountLinking)
|
||||||
{
|
{
|
||||||
var usedIps = await ctx.Aliases.AsNoTracking()
|
var usedIps = await ctx.Aliases.AsNoTracking()
|
||||||
.Where(alias => alias.LinkId == linkId && alias.IPAddress != null)
|
.Where(alias => (alias.LinkId == linkId.AliasLinkId || alias.AliasId == linkId.CurrentAliasId) && alias.IPAddress != null)
|
||||||
.Select(alias => alias.IPAddress).ToListAsync();
|
.Select(alias => alias.IPAddress).ToListAsync();
|
||||||
|
|
||||||
var aliasedIds = await ctx.Aliases.AsNoTracking().Where(alias => usedIps.Contains(alias.IPAddress))
|
var aliasedIds = await ctx.Aliases.AsNoTracking().Where(alias => usedIps.Contains(alias.IPAddress))
|
||||||
@ -61,8 +61,7 @@ namespace IW4MAdmin.Application.Meta
|
|||||||
|
|
||||||
iqIpLinkedPenalties = ctx.Penalties.AsNoTracking()
|
iqIpLinkedPenalties = ctx.Penalties.AsNoTracking()
|
||||||
.Where(penalty =>
|
.Where(penalty =>
|
||||||
linkedPenaltyType.Contains(penalty.Type) &&
|
linkedPenaltyType.Contains(penalty.Type) && aliasedIds.Contains(penalty.LinkId));
|
||||||
/*usedIps.Contains(penalty.Offender.CurrentAlias.IPAddress)*/aliasedIds.Contains(penalty.LinkId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var penalties = await iqPenalties.Union(iqIpLinkedPenalties)
|
var penalties = await iqPenalties.Union(iqIpLinkedPenalties)
|
||||||
|
@ -339,14 +339,6 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
if (existingExactAlias != null)
|
if (existingExactAlias != null)
|
||||||
{
|
{
|
||||||
/*if (existingExactAlias.LinkId != entity.AliasLinkId)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("[{Method}] client {Client} is linked to link id {OldLinkId}, but since name and IP match exactly, updating to new link id {NewLinkId}",
|
|
||||||
nameof(UpdateAliasNew), entity.ToString(), existingExactAlias.LinkId, entity.AliasLinkId);
|
|
||||||
existingExactAlias.LinkId = entity.AliasLinkId;
|
|
||||||
await context.SaveChangesAsync();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
entity.CurrentAlias = existingExactAlias;
|
entity.CurrentAlias = existingExactAlias;
|
||||||
entity.CurrentAliasId = existingExactAlias.AliasId;
|
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
@ -680,7 +672,7 @@ namespace SharedLibraryCore.Services
|
|||||||
public async Task<IList<PlayerInfo>> FindClientsByIdentifier(string identifier)
|
public async Task<IList<PlayerInfo>> FindClientsByIdentifier(string identifier)
|
||||||
{
|
{
|
||||||
var trimmedIdentifier = identifier?.Trim();
|
var trimmedIdentifier = identifier?.Trim();
|
||||||
if (trimmedIdentifier?.Length < 3)
|
if (trimmedIdentifier?.Length < _appConfig.MinimumNameLength)
|
||||||
{
|
{
|
||||||
return new List<PlayerInfo>();
|
return new List<PlayerInfo>();
|
||||||
}
|
}
|
||||||
@ -718,7 +710,8 @@ namespace SharedLibraryCore.Services
|
|||||||
.Where(_client => _client.Active);
|
.Where(_client => _client.Active);
|
||||||
|
|
||||||
|
|
||||||
iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId));
|
iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId)
|
||||||
|
|| !_appConfig.EnableImplicitAccountLinking && _client.CurrentAlias.IPAddress == ipAddress);
|
||||||
|
|
||||||
// we want to project our results
|
// we want to project our results
|
||||||
var iqClientProjection = iqClients.OrderByDescending(_client => _client.LastConnection)
|
var iqClientProjection = iqClients.OrderByDescending(_client => _client.LastConnection)
|
||||||
|
Loading…
Reference in New Issue
Block a user