fix more issues with implicit link toggle
This commit is contained in:
parent
7e1221f467
commit
0b6e261dbb
@ -362,7 +362,7 @@ namespace IW4MAdmin
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
await E.Origin.OnJoin(E.Origin.IPAddress);
|
await E.Origin.OnJoin(E.Origin.IPAddress, Manager.GetApplicationSettings().Configuration().EnableImplicitAccountLinking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +738,7 @@ namespace IW4MAdmin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await client.OnJoin(origin.IPAddress);
|
await client.OnJoin(origin.IPAddress, Manager.GetApplicationSettings().Configuration().EnableImplicitAccountLinking);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -754,7 +754,7 @@ namespace IW4MAdmin
|
|||||||
client.Level == Permission.Banned)
|
client.Level == Permission.Banned)
|
||||||
{
|
{
|
||||||
ServerLogger.LogWarning("{client} state is Unknown (probably kicked), but they are still connected. trying to kick again...", origin.ToString());
|
ServerLogger.LogWarning("{client} state is Unknown (probably kicked), but they are still connected. trying to kick again...", origin.ToString());
|
||||||
await client.CanConnect(client.IPAddress);
|
await client.CanConnect(client.IPAddress, Manager.GetApplicationSettings().Configuration().EnableImplicitAccountLinking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnJoin(int? ipAddress)
|
public async Task OnJoin(int? ipAddress, bool enableImplicitLinking)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Server", CurrentServer?.ToString()))
|
using (LogContext.PushProperty("Server", CurrentServer?.ToString()))
|
||||||
{
|
{
|
||||||
@ -537,7 +537,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
await CurrentServer.Manager.GetClientService().UpdateAlias(this);
|
await CurrentServer.Manager.GetClientService().UpdateAlias(this);
|
||||||
await CurrentServer.Manager.GetClientService().Update(this);
|
await CurrentServer.Manager.GetClientService().Update(this);
|
||||||
|
|
||||||
bool canConnect = await CanConnect(ipAddress);
|
var canConnect = await CanConnect(ipAddress, enableImplicitLinking);
|
||||||
|
|
||||||
if (!canConnect)
|
if (!canConnect)
|
||||||
{
|
{
|
||||||
@ -569,7 +569,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> CanConnect(int? ipAddress)
|
public async Task<bool> CanConnect(int? ipAddress, bool enableImplicitLinking)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Server", CurrentServer?.ToString()))
|
using (LogContext.PushProperty("Server", CurrentServer?.ToString()))
|
||||||
{
|
{
|
||||||
@ -594,18 +594,27 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
// we want to kick them if any account is banned
|
// we want to kick them if any account is banned
|
||||||
if (banPenalty != null)
|
if (banPenalty != null)
|
||||||
{
|
{
|
||||||
if (Level != Permission.Banned)
|
if (enableImplicitLinking)
|
||||||
{
|
{
|
||||||
Utilities.DefaultLogger.LogInformation(
|
if (Level != Permission.Banned)
|
||||||
"Client {client} is banned, but using a new GUID, we we're updating their level and kicking them",
|
{
|
||||||
ToString());
|
Utilities.DefaultLogger.LogInformation(
|
||||||
await SetLevel(Permission.Banned, autoKickClient).WaitAsync(Utilities.DefaultCommandTimeout,
|
"Client {client} is banned, but using a new GUID, we we're updating their level and kicking them",
|
||||||
CurrentServer.Manager.CancellationToken);
|
ToString());
|
||||||
|
await SetLevel(Permission.Banned, autoKickClient).WaitAsync(Utilities.DefaultCommandTimeout,
|
||||||
|
CurrentServer.Manager.CancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
Utilities.DefaultLogger.LogInformation("Kicking {client} because they are banned", ToString());
|
||||||
|
Kick(loc["WEBFRONT_PENALTY_LIST_BANNED_REASON"], autoKickClient, banPenalty);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities.DefaultLogger.LogInformation("Kicking {client} because they are banned", ToString());
|
if (Level != Permission.Banned)
|
||||||
Kick(loc["WEBFRONT_PENALTY_LIST_BANNED_REASON"], autoKickClient, banPenalty);
|
{
|
||||||
return false;
|
Ban(banPenalty.Offense, autoKickClient, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want to kick them if any account is tempbanned
|
// we want to kick them if any account is tempbanned
|
||||||
|
@ -332,13 +332,16 @@ namespace SharedLibraryCore.Services
|
|||||||
{
|
{
|
||||||
defaultAlias.IPAddress = ip;
|
defaultAlias.IPAddress = ip;
|
||||||
entity.CurrentAlias = defaultAlias;
|
entity.CurrentAlias = defaultAlias;
|
||||||
|
entity.CurrentAliasId = defaultAlias.AliasId;
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingExactAlias != null)
|
if (existingExactAlias != null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("[{Method}] client {Client} already has an existing exact alias, so we are not updating", nameof(UpdateAliasNew), entity.ToString());
|
entity.CurrentAlias = existingExactAlias;
|
||||||
|
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||||
|
_logger.LogDebug("[{Method}] client {Client} already has an existing exact alias, so we are not making changes", nameof(UpdateAliasNew), entity.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +359,7 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
entity.CurrentAlias = newAlias;
|
entity.CurrentAlias = newAlias;
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
|
entity.CurrentAliasId = newAlias.AliasId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -97,6 +97,6 @@
|
|||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="MyPreCompileTarget" BeforeTargets="Build">
|
<Target Name="MyPreCompileTarget" BeforeTargets="Build">
|
||||||
<Exec Command="dotnet bundle" />
|
<!-- <Exec Command="dotnet bundle" />-->
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user