Compare commits
No commits in common. "release/pre" and "2023.09.02.4-prerelease" have entirely different histories.
release/pr
...
2023.09.02
@ -8,11 +8,9 @@ using Data.Abstractions;
|
||||
using Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using WebfrontCore.Permissions;
|
||||
using WebfrontCore.QueryHelpers.Models;
|
||||
using EFClient = Data.Models.Client.EFClient;
|
||||
|
||||
@ -20,7 +18,6 @@ namespace IW4MAdmin.Application.QueryHelpers;
|
||||
|
||||
public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse>
|
||||
{
|
||||
public ApplicationConfiguration _appConfig { get; }
|
||||
private readonly IDatabaseContextFactory _contextFactory;
|
||||
private readonly IGeoLocationService _geoLocationService;
|
||||
|
||||
@ -30,10 +27,8 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
public EFAlias Alias { get; set; }
|
||||
}
|
||||
|
||||
public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService,
|
||||
ApplicationConfiguration appConfig)
|
||||
public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService)
|
||||
{
|
||||
_appConfig = appConfig;
|
||||
_contextFactory = contextFactory;
|
||||
_geoLocationService = geoLocationService;
|
||||
}
|
||||
@ -80,9 +75,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.ClientIp))
|
||||
{
|
||||
clientAliases = SearchByIp(query, clientAliases,
|
||||
_appConfig.HasPermission(query.RequesterPermission, WebfrontEntity.ClientIPAddress,
|
||||
WebfrontPermission.Read));
|
||||
clientAliases = SearchByIp(query, clientAliases);
|
||||
}
|
||||
|
||||
var iqGroupedClientAliases = clientAliases.GroupBy(a => new { a.Client.ClientId, a.Client.LastConnection });
|
||||
@ -210,7 +203,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
}
|
||||
|
||||
private static IQueryable<ClientAlias> SearchByIp(ClientResourceRequest query,
|
||||
IQueryable<ClientAlias> clientAliases, bool canSearchIP)
|
||||
IQueryable<ClientAlias> clientAliases)
|
||||
{
|
||||
var ipString = query.ClientIp.Trim();
|
||||
var ipAddress = ipString.ConvertToIP();
|
||||
@ -220,7 +213,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
clientAliases = clientAliases.Where(clientAlias =>
|
||||
clientAlias.Alias.IPAddress != null && clientAlias.Alias.IPAddress == ipAddress);
|
||||
}
|
||||
else if(canSearchIP)
|
||||
else
|
||||
{
|
||||
clientAliases = clientAliases.Where(clientAlias =>
|
||||
EF.Functions.Like(clientAlias.Alias.SearchableIPAddress, $"{ipString}%"));
|
||||
|
@ -56,4 +56,4 @@ Feel free to join the **IW4MAdmin** [Discord](https://discord.gg/ZZFK5p3)
|
||||
If you come across an issue, bug, or feature request please post an [issue](https://github.com/RaidMax/IW4M-Admin/issues)
|
||||
|
||||
|
||||
#### Explore the [wiki](https://git.rimmyscorner.com/Parasyn/IW4M-Admin/wiki) to find more information.
|
||||
#### Explore the [wiki](https://github.com/RaidMax/IW4M-Admin/wiki) to find more information.
|
||||
|
@ -250,7 +250,6 @@ namespace WebfrontCore.Controllers
|
||||
ViewBag.Title = Localization["WEBFRONT_SEARCH_RESULTS_TITLE"];
|
||||
ViewBag.ClientResourceRequest = request;
|
||||
|
||||
request.RequesterPermission = Client.Level;
|
||||
var response = await _clientResourceHelper.QueryResource(request);
|
||||
return request.Offset > 0
|
||||
? PartialView("Find/_AdvancedFindList", response.Results)
|
||||
|
@ -17,8 +17,6 @@ public class ClientResourceRequest : ClientPaginationRequest
|
||||
public Reference.Game? GameName { get; set; }
|
||||
public bool IncludeGeolocationData { get; set; } = true;
|
||||
|
||||
public EFClient.Permission RequesterPermission { get; set; } = EFClient.Permission.User;
|
||||
|
||||
public bool HasData => !string.IsNullOrEmpty(ClientName) || !string.IsNullOrEmpty(ClientIp) ||
|
||||
!string.IsNullOrEmpty(ClientGuid) || ClientLevel is not null || GameName is not null;
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user