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() : "-";
|
||||||
}
|
}
|
||||||
@ -79,7 +80,7 @@
|
|||||||
</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>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user