fix only one administrator showing on admins page

fix profanity determent not applying penalties.
This commit is contained in:
RaidMax 2018-11-25 21:11:55 -06:00
parent 5ac8a55c72
commit abf0609e2e
3 changed files with 9 additions and 14 deletions

View File

@ -86,22 +86,14 @@ namespace IW4MAdmin.Plugins.ProfanityDeterment
var clientProfanity = ProfanityCounts[E.Origin.ClientId]; var clientProfanity = ProfanityCounts[E.Origin.ClientId];
if (clientProfanity.Infringements >= Settings.Configuration().KickAfterInfringementCount) if (clientProfanity.Infringements >= Settings.Configuration().KickAfterInfringementCount)
{ {
clientProfanity.Client.Kick(Settings.Configuration().ProfanityKickMessage, new EFClient() clientProfanity.Client.Kick(Settings.Configuration().ProfanityKickMessage, Utilities.IW4MAdminClient(E.Owner));
{
ClientId = 1,
CurrentServer = E.Owner
});
} }
else if (clientProfanity.Infringements < Settings.Configuration().KickAfterInfringementCount) else if (clientProfanity.Infringements < Settings.Configuration().KickAfterInfringementCount)
{ {
clientProfanity.Infringements++; clientProfanity.Infringements++;
clientProfanity.Client.Warn(Settings.Configuration().ProfanityWarningMessage, new EFClient() clientProfanity.Client.Warn(Settings.Configuration().ProfanityWarningMessage, Utilities.IW4MAdminClient(E.Owner));
{
ClientId = 1,
CurrentServer = E.Owner
});
} }
} }
} }

View File

@ -317,6 +317,7 @@ namespace SharedLibraryCore.Services
where client.Active where client.Active
select new EFClient() select new EFClient()
{ {
AliasLinkId = client.AliasLinkId,
CurrentAlias = client.CurrentAlias, CurrentAlias = client.CurrentAlias,
ClientId = client.ClientId, ClientId = client.ClientId,
Level = client.Level, Level = client.Level,

View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models; using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Services; using SharedLibraryCore.Services;
@ -8,7 +7,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static SharedLibraryCore.Objects.Penalty;
namespace WebfrontCore.Controllers namespace WebfrontCore.Controllers
{ {
@ -65,6 +63,7 @@ namespace WebfrontCore.Controllers
.ReadGetClientPenaltiesAsync(client.ClientId, false); .ReadGetClientPenaltiesAsync(client.ClientId, false);
if (Authorized && client.Level > EFClient.Permission.Trusted) if (Authorized && client.Level > EFClient.Permission.Trusted)
{
clientDto.Meta.Add(new ProfileMeta() clientDto.Meta.Add(new ProfileMeta()
{ {
Key = Localization["WEBFRONT_CLIENT_META_MASKED"], Key = Localization["WEBFRONT_CLIENT_META_MASKED"],
@ -72,6 +71,7 @@ namespace WebfrontCore.Controllers
Sensitive = true, Sensitive = true,
When = DateTime.MinValue When = DateTime.MinValue
}); });
}
if (Authorized) if (Authorized)
{ {
@ -120,15 +120,17 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> PrivilegedAsync() public async Task<IActionResult> PrivilegedAsync()
{ {
var admins = (await Manager.GetClientService().GetPrivilegedClients()) var admins = (await Manager.GetClientService().GetPrivilegedClients())
.OrderByDescending(a => a.Level) .GroupBy(a => a.AliasLinkId).Select(_clients => _clients.OrderBy(_client => _client.LastConnection).LastOrDefault())
.GroupBy(a => a.AliasLinkId).Select(a => a.First()); .OrderByDescending(_client => _client.Level);
var adminsDict = new Dictionary<EFClient.Permission, IList<ClientInfo>>(); var adminsDict = new Dictionary<EFClient.Permission, IList<ClientInfo>>();
foreach (var admin in admins) foreach (var admin in admins)
{ {
if (!adminsDict.ContainsKey(admin.Level)) if (!adminsDict.ContainsKey(admin.Level))
{
adminsDict.Add(admin.Level, new List<ClientInfo>()); adminsDict.Add(admin.Level, new List<ClientInfo>());
}
adminsDict[admin.Level].Add(new ClientInfo() adminsDict[admin.Level].Add(new ClientInfo()
{ {