implement admin "privacy" for issue #185
This commit is contained in:
parent
843c01061d
commit
28373b9325
@ -134,6 +134,7 @@ namespace SharedLibraryCore
|
|||||||
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
|
ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
|
||||||
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
||||||
|
ViewBag.EnablePrivilegedUserPrivacy = Manager.GetApplicationSettings().Configuration().EnablePrivilegedUserPrivacy;
|
||||||
|
|
||||||
base.OnActionExecuting(context);
|
base.OnActionExecuting(context);
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,8 @@ namespace SharedLibraryCore.Configuration
|
|||||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_PRESET_BAN_REASONS")]
|
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_PRESET_BAN_REASONS")]
|
||||||
public Dictionary<string, string> PresetPenaltyReasons { get; set; } = new Dictionary<string, string>
|
public Dictionary<string, string> PresetPenaltyReasons { get; set; } = new Dictionary<string, string>
|
||||||
{{"afk", "Away from keyboard"}, {"ci", "Connection interrupted. Reconnect"}};
|
{{"afk", "Away from keyboard"}, {"ci", "Connection interrupted. Reconnect"}};
|
||||||
|
[LocalizedDisplayName(("WEBFRONT_CONFIGURATION_ENABLE_PRIVILEGED_USER_PRIVACY"))]
|
||||||
|
public bool EnablePrivilegedUserPrivacy { get; set; }
|
||||||
[UIHint("ServerConfiguration")]
|
[UIHint("ServerConfiguration")]
|
||||||
public ServerConfiguration[] Servers { get; set; }
|
public ServerConfiguration[] Servers { get; set; }
|
||||||
|
|
||||||
|
@ -20,7 +20,14 @@
|
|||||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
|
||||||
|
{
|
||||||
|
<div class="col-4 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<div class="col-4 level-color-@client.LevelInt">@client.Level</div>
|
<div class="col-4 level-color-@client.LevelInt">@client.Level</div>
|
||||||
|
}
|
||||||
<div class="col-3 text-right">@client.LastConnectionText</div>
|
<div class="col-3 text-right">@client.LastConnectionText</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@ -41,7 +48,14 @@
|
|||||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
|
||||||
|
{
|
||||||
|
<div class="p-2 level-color-0">@loc["GLOBAL_PERMISSION_USER"]</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<div class="p-2 level-color-@client.LevelInt">@client.Level</div>
|
<div class="p-2 level-color-@client.LevelInt">@client.Level</div>
|
||||||
|
}
|
||||||
<div class="p-2 text-white-50">@client.LastConnectionText</div>
|
<div class="p-2 text-white-50">@client.LastConnectionText</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div id="profile_wrapper" class="pb-3 row d-flex flex-column flex-lg-row">
|
<div id="profile_wrapper" class="pb-3 row d-flex flex-column flex-lg-row">
|
||||||
<!-- Initial/Avatar Column -->
|
<!-- Initial/Avatar Column -->
|
||||||
<div id="profile_avatar" class="d-block d-lg-inline-flex flex-column mr-auto ml-auto mr-lg-0 ml-lg-0 justify-content-center text-center level-bgcolor-@Model.LevelInt @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@string.Format("https://gravatar.com/avatar/{0}?size=168&default=blank&rating=pg", gravatarUrl)')">
|
<div id="profile_avatar" class="d-block d-lg-inline-flex flex-column mr-auto ml-auto mr-lg-0 ml-lg-0 justify-content-center text-center level-bgcolor-@(!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy ? "0" : Model.LevelInt.ToString()) @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@string.Format("https://gravatar.com/avatar/{0}?size=168&default=blank&rating=pg", gravatarUrl)')">
|
||||||
@if (string.IsNullOrEmpty(gravatarUrl))
|
@if (string.IsNullOrEmpty(gravatarUrl))
|
||||||
{
|
{
|
||||||
<span class="profile-shortcode">@shortCode</span>
|
<span class="profile-shortcode">@shortCode</span>
|
||||||
@ -72,12 +72,22 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
|
||||||
|
{
|
||||||
|
<div id="profile_level" class="font-weight-bold h4 mb-0 level-color-0">
|
||||||
|
@ViewBag.Localization["GLOBAL_PERMISSION_USER"]
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div id="profile_level" class="font-weight-bold h4 mb-0 level-color-@Model.LevelInt">
|
<div id="profile_level" class="font-weight-bold h4 mb-0 level-color-@Model.LevelInt">
|
||||||
@Model.Level
|
@Model.Level
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
@if (ViewBag.Authorized)
|
@if (ViewBag.Authorized)
|
||||||
{
|
{
|
||||||
@ -142,11 +152,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ((!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy) || ViewBag.Authorized)
|
||||||
|
{
|
||||||
<div class="row d-md-flex pt-2">
|
<div class="row d-md-flex pt-2">
|
||||||
<div id="profile_events" class="text-muted text-left pl-4 pr-4 pl-md-0 pr-md-0">
|
<div id="profile_events" class="text-muted text-left pl-4 pr-4 pl-md-0 pr-md-0">
|
||||||
@await Component.InvokeAsync("ProfileMetaList", new {clientId = Model.ClientId, count = 30, offset = 0, startAt = DateTime.UtcNow, metaType = Model.MetaFilterType})
|
@await Component.InvokeAsync("ProfileMetaList", new {clientId = Model.ClientId, count = 30, offset = 0, startAt = DateTime.UtcNow, metaType = Model.MetaFilterType})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="oi oi-chevron-bottom text-center mt-2 btn btn-primary btn-block loader-load-more" title="Load more meta" data-action="unban" aria-hidden="true"></div>
|
<div class="oi oi-chevron-bottom text-center mt-2 btn btn-primary btn-block loader-load-more" title="Load more meta" data-action="unban" aria-hidden="true"></div>
|
||||||
|
@ -31,7 +31,12 @@
|
|||||||
<tr class="d-table-row d-lg-none bg-dark">
|
<tr class="d-table-row d-lg-none bg-dark">
|
||||||
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
|
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel })
|
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
|
||||||
|
"Client",
|
||||||
|
new { id = Model.PunisherId },
|
||||||
|
new { @class = !ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy
|
||||||
|
? "level-color-0"
|
||||||
|
: "level-color-" + (int)Model.PunisherLevel })
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -64,7 +69,12 @@
|
|||||||
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
|
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel })
|
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
|
||||||
|
"Client",
|
||||||
|
new { id = Model.PunisherId },
|
||||||
|
new { @class = !ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy
|
||||||
|
? "level-color-0"
|
||||||
|
: "level-color-" + (int)Model.PunisherLevel })
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right text-light">
|
<td class="text-right text-light">
|
||||||
@{
|
@{
|
||||||
|
@ -35,7 +35,14 @@
|
|||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HOME"], "Index", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HOME"], "Index", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PENALTIES"], "List", "Penalty", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PENALTIES"], "List", "Penalty", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
|
@if (ViewBag.Authorized)
|
||||||
|
{
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
}
|
||||||
|
else if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy)
|
||||||
|
{
|
||||||
|
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
}
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HELP"], "Help", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HELP"], "Help", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||||
@foreach (var _page in ViewBag.Pages)
|
@foreach (var _page in ViewBag.Pages)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user