fix permissions issue with search
This commit is contained in:
parent
6edf3f1ae9
commit
12e3fd9238
@ -8,15 +8,16 @@
|
|||||||
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
var loc = Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
var client = Model;
|
var client = Model;
|
||||||
|
|
||||||
|
var canSeeLevel = (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read);
|
||||||
|
var canSeeIp = (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientIPAddress, WebfrontPermission.Read);
|
||||||
|
|
||||||
string FormatNameChange(ClientResourceResponse clientResponse)
|
string FormatNameChange(ClientResourceResponse clientResponse)
|
||||||
{
|
{
|
||||||
return clientResponse.CurrentClientName.StripColors() != clientResponse.MatchedClientName?.StripColors()
|
return clientResponse.CurrentClientName.StripColors() != clientResponse.MatchedClientName?.StripColors()
|
||||||
? $"{clientResponse.CurrentClientName} [{clientResponse.MatchedClientName}{(clientResponse.MatchedClientIp is null && clientResponse.MatchedClientIp != clientResponse.CurrentClientIp ? "" : $"/{clientResponse.MatchedClientIp.ConvertIPtoString()}")}]"
|
? $"{clientResponse.CurrentClientName} [{clientResponse.MatchedClientName}{((clientResponse.MatchedClientIp is null && clientResponse.MatchedClientIp != clientResponse.CurrentClientIp) ? "" : $"/{FormatIpForPermission(clientResponse.MatchedClientIp)}")}]"
|
||||||
: clientResponse.CurrentClientName;
|
: clientResponse.CurrentClientName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var canSeeLevel = (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read);
|
|
||||||
var canSeeIp = (ViewBag.PermissionsSet as IEnumerable<string>).HasPermission(WebfrontEntity.ClientIPAddress, WebfrontPermission.Read);
|
|
||||||
string ClassForLevel(EFClient.Permission permission) => !canSeeLevel ? "level-color-user" : $"level-color-{permission.ToString().ToLower()}";
|
string ClassForLevel(EFClient.Permission permission) => !canSeeLevel ? "level-color-user" : $"level-color-{permission.ToString().ToLower()}";
|
||||||
string FormatIpForPermission(int? ip) => canSeeIp && ip is not null ? ip.ConvertIPtoString() : "-";
|
string FormatIpForPermission(int? ip) => canSeeIp && ip is not null ? ip.ConvertIPtoString() : "-";
|
||||||
}
|
}
|
||||||
@ -73,16 +74,16 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="w-half bg-dark">
|
<td class="w-half bg-dark">
|
||||||
<div class="pb-5">
|
<div class="pb-5">
|
||||||
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="no-decoration @ClassForLevel(client.ClientLevelValue)">
|
<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId" class="no-decoration @ClassForLevel(client.ClientLevelValue)">
|
||||||
<color-code value="@client.CurrentClientName"></color-code>
|
<color-code value="@client.CurrentClientName"></color-code>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="pb-5">
|
<div class="pb-5">
|
||||||
<color-code value="@client.MatchedClientName"></color-code>
|
<color-code value="@client.MatchedClientName"></color-code>
|
||||||
@if (client.MatchedClientIp != client.CurrentClientIp)
|
@if (client.MatchedClientIp != client.CurrentClientIp && canSeeIp)
|
||||||
{
|
{
|
||||||
<span>/ @client.MatchedClientIp.ConvertIPtoString()</span>
|
<span>/ @client.MatchedClientIp.ConvertIPtoString()</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted pb-5">
|
<div class="text-muted pb-5">
|
||||||
@FormatIpForPermission(client.CurrentClientIp)
|
@FormatIpForPermission(client.CurrentClientIp)
|
||||||
|
Loading…
Reference in New Issue
Block a user