qol: fix System.Net.Http dependencies

This commit is contained in:
Gary Sharp
2025-02-26 13:16:29 +11:00
parent d2b5e7ab6a
commit 539503133a
8 changed files with 350 additions and 329 deletions
-2
View File
@@ -53,7 +53,6 @@
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
@@ -62,7 +61,6 @@
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
+2 -4
View File
@@ -65,16 +65,14 @@ namespace Disco.Models.Repository
public AttachmentTypes HasAttachmentType { get { return AttachmentTypes.User; } }
public override string ToString()
{
return string.Format("{0} ({1})", this.DisplayName, this.UserId);
}
=> $"{DisplayName} ({UserId})";
public bool UpdateSelf(User u)
{
var changed = false;
if (!this.UserId.Equals(u.UserId, StringComparison.OrdinalIgnoreCase))
throw new ArgumentException("User Id's do not match", "u");
throw new ArgumentException("User Id's do not match", nameof(u));
if (this.Surname != u.Surname)
{
@@ -37,20 +37,10 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -14,7 +14,7 @@ namespace Disco.Services.Plugins
public void OnAuthorization(AuthorizationContext authorizationContext, string actionName)
{
var actionDescriptor = (PluginActionDescriptor)authorizationContext.ActionDescriptor;
var authorizationFilters = actionDescriptor.GetAuthorizationFilters;
foreach (var filter in authorizationFilters)
{
@@ -144,11 +144,28 @@ namespace Disco.Services.Plugins
{
this.controllerDescription = controllerDescription;
this.methodInfo = methodInfo;
UniqueId = $"{ControllerDescriptor.UniqueId}_{methodName}";
ActionName = methodName;
authorizationFilters = DiscoverAuthorizationFilters();
methodSelector = DiscoverMethodSelector();
parameterDescriptors = DiscoverParameters();
switch (methodSelector)
{
case HttpPostAttribute _:
methodName += ":POST";
break;
case HttpGetAttribute _:
methodName += ":GET";
break;
case HttpPutAttribute _:
methodName += ":PUT";
break;
case HttpDeleteAttribute _:
methodName += ":DELETE";
break;
}
ActionName = methodName;
UniqueId = $"{ControllerDescriptor.UniqueId}_{methodName}";
}
private IAuthorizationFilter[] DiscoverAuthorizationFilters()
@@ -311,14 +328,19 @@ namespace Disco.Services.Plugins
var methods = Array.FindAll(ControllerType.GetMethods(BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), mi => { return !mi.IsSpecialName && typeof(ActionResult).IsAssignableFrom(mi.ReturnType); });
foreach (var method in methods)
{
actions.Add(method.Name, new PluginActionDescriptor(this, method.Name, method));
var descriptor = new PluginActionDescriptor(this, method.Name, method);
actions.Add(descriptor.ActionName, descriptor);
}
return actions;
}
public override ActionDescriptor FindAction(ControllerContext controllerContext, string actionName)
{
if (actions.TryGetValue(actionName, out var action))
var method = controllerContext.HttpContext.Request.HttpMethod.ToUpperInvariant();
if (actions.TryGetValue($"{actionName}:{method}", out var action))
return action;
if (actions.TryGetValue(actionName, out action))
return action;
else
return null;
@@ -50,14 +50,12 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
+32 -30
View File
@@ -1,6 +1,5 @@
@* Generator: WebPagesHelper *@
@using Disco;
@using Disco.BI.Extensions;
@using Disco.Models.Repository;
@using Disco.Services;
@using Disco.Services.Web;
@@ -9,9 +8,9 @@
@using System.Web.Mvc.Html;
@helper FriendlyDate(DateTime d, string ElementId = null, bool WithoutSuffix = false)
{<span @(ElementId == null ? null : new HtmlString(string.Format("id=\"{0}\" ", ElementId)))title="@d.ToFullDateTime()" data-livestamp="@d.ToUnixEpoc()" data-isodate="@d.ToISO8601()" class="date nowrap@(WithoutSuffix ? " noMomentSuffix" : null)">@d.ToFullDateTime()</span>}
{<span @(ElementId == null ? null : new HtmlString(string.Format("id=\"{0}\" ", ElementId))) title="@d.ToFullDateTime()" data-livestamp="@d.ToUnixEpoc()" data-isodate="@d.ToISO8601()" class="date nowrap@(WithoutSuffix ? " noMomentSuffix" : null)">@d.ToFullDateTime()</span>}
@helper FriendlyDate(DateTime? d, string NullValue = "n/a", string ElementId = null, bool WithoutSuffix = false)
{<span @(ElementId == null ? null : new HtmlString(string.Format("id=\"{0}\" ", ElementId)))title="@d.ToFullDateTime(NullValue)" data-livestamp="@d.ToUnixEpoc()" data-isodate="@d.ToISO8601()" class="date nowrap@(WithoutSuffix ? " noMomentSuffix" : null)">@d.ToFullDateTime(NullValue)</span>}
{<span @(ElementId == null ? null : new HtmlString(string.Format("id=\"{0}\" ", ElementId))) title="@d.ToFullDateTime(NullValue)" data-livestamp="@d.ToUnixEpoc()" data-isodate="@d.ToISO8601()" class="date nowrap@(WithoutSuffix ? " noMomentSuffix" : null)">@d.ToFullDateTime(NullValue)</span>}
@helper FriendlyDateAndUser(DateTime? d, User u, string DateNullValue = "n/a", bool WithoutSuffix = false)
{
@FriendlyDate(d, DateNullValue, WithoutSuffix: WithoutSuffix);
@@ -43,23 +42,23 @@
@helper FriendlyUser(User u, string nullValue = null, string prepend = null)
{
if (u != null)
{
@prepend <span title="@u">@u.FriendlyId()</span>
{
@prepend <span title="@u">@u.FriendlyId()</span>
}
else
{
<span>@nullValue</span>
{
<span>@nullValue</span>
}
}
@helper FriendlyUser(string UserId, string nullValue = null, string prepend = null)
{
if (UserId != null)
{
@prepend <span>@Disco.Services.Interop.ActiveDirectory.ActiveDirectory.FriendlyAccountId(UserId)</span>
{
@prepend <span>@Disco.Services.Interop.ActiveDirectory.ActiveDirectory.FriendlyAccountId(UserId)</span>
}
else
{
<span>@nullValue</span>
{
<span>@nullValue</span>
}
}
@@ -102,21 +101,24 @@
<tr>
@for (int i = 0; i < columns; i++)
{
<td@(alignEven ? new HtmlString(string.Format(" style=\"width: {0}%\"", columnWidth)) : new HtmlString(string.Empty))>
<td @(alignEven ? new HtmlString(string.Format(" style=\"width: {0}%\"", columnWidth)) : new HtmlString(string.Empty))>
<ul class="none">
@{
int itemsForThisColumn = itemsPerColumn + (items.Count % columns > i ? 1 : 0);
for (int i2 = 0; i2 < itemsForThisColumn && itemNextId < items.Count; i2++)
{
var item = items[itemNextId];
itemNextId++;
var itemId = forceUniqueIds.HasValue ? string.Format("{0}_{1}_{2}", id, item.Value, forceUniqueIds++) : string.Format("{0}_{1}", id, item.Value);
<li>
<input id="@itemId" name="@id" value="@item.Value" type="@inputType" @(item.Selected ? new HtmlString("checked=\"checked\" ") : null)/><label for="@itemId">@if (htmlEncodeText)
{ @item.Text }
else
{ @(new HtmlString(item.Text)) }</label></li>
}
int itemsForThisColumn = itemsPerColumn + (items.Count % columns > i ? 1 : 0);
for (int i2 = 0; i2 < itemsForThisColumn && itemNextId < items.Count; i2++)
{
var item = items[itemNextId];
itemNextId++;
var itemId = forceUniqueIds.HasValue ? string.Format("{0}_{1}_{2}", id, item.Value, forceUniqueIds++) : string.Format("{0}_{1}", id, item.Value);
<li>
<input id="@itemId" name="@id" value="@item.Value" type="@inputType" @(item.Selected ? new HtmlString("checked=\"checked\" ") : null) /><label for="@itemId">
@if (htmlEncodeText)
{@item.Text }
else
{ @(new HtmlString(item.Text))}
</label>
</li>
}
}
</ul>
</td>
@@ -133,15 +135,15 @@
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
<span>&gt;</span>
<span>&gt;</span>
}
if (breadCrumb.Item2 == null)
{
@breadCrumb.Item1
<span title="@breadCrumb.Item1">@breadCrumb.Item1</span>
}
else
{
@Html.GetPageHelper().ActionLink(breadCrumb.Item1, breadCrumb.Item2)
{
@Html.GetPageHelper().ActionLink(breadCrumb.Item1, breadCrumb.Item2)
}
}
}
@@ -156,9 +158,9 @@
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
@(new HtmlString(" > "))
@(new HtmlString(" > "))
}
@breadCrumb.Item1
@breadCrumb.Item1
}
}
@helper BreadcrumbsTitle(string Title)
File diff suppressed because it is too large Load Diff
-4
View File
@@ -183,10 +183,6 @@
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="T4MVCExtensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL">
<HintPath>..\packages\T4MVCExtensions.3.17.5\lib\net40\T4MVCExtensions.dll</HintPath>