From c06177732da4a510084055e185422e12372cc50c Mon Sep 17 00:00:00 2001 From: Andy Howard Date: Tue, 8 Jun 2021 12:26:39 +0100 Subject: [PATCH] v1.0.7.0 --- ReadMe.md | 9 + Saxonite.sln | 5 +- SaxoniteCoreWeb/Base/App/SaxStartup.cs | 9 + .../Base/App/SaxyAuthenticationHandler.cs | 6 + .../Middleware/SaxAuthenticationHandler.cs | 46 ++ .../Admin/Models/Model_User.cs | 2 +- .../Views/Shared/_Layout.cshtml | 8 +- SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css | 4 +- SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css | 5 + SaxoniteCoreWebAdmin/wwwroot/css/sax-main.css | 1 + .../Localisation/SaxOnlineProperties.resx | 24 + .../AccountController-Ajax-Contact.cs | 151 +++++ .../Controllers/AccountController-Image.cs | 124 ++++ .../Controllers/ActivityController-Ajax.cs | 5 + .../Online/Models/Model_Account.cs | 5 +- .../Views/Account/Profile-Contact.cshtml | 156 +++-- .../Views/Account/Profile.cshtml | 8 +- .../Views/Common/SelectOrganisation.cshtml | 2 +- .../Views/Common/SelectRegion.cshtml | 2 +- .../Views/Common/SelectSport.cshtml | 2 +- .../Views/Organisation/Opportunities.cshtml | 2 +- .../Views/Security/Signin.cshtml | 16 +- .../Views/Shared/_Layout.cshtml | 11 +- .../wwwroot/css/sax-account.css | 42 +- .../wwwroot/css/sax-data.css | 26 +- .../wwwroot/css/sax-form.css | 23 +- .../wwwroot/css/sax-main.css | 18 +- .../img/animated/progress-basketball-32.gif | Bin 0 -> 21788 bytes .../img/animated/progress-basketball-64.gif | Bin 0 -> 41296 bytes .../wwwroot/img/animated/progress-cog-32.gif | Bin 0 -> 18838 bytes .../wwwroot/img/animated/progress-cog-64.gif | Bin 0 -> 39529 bytes .../wwwroot/js/sax-account.js | 106 +++- SaxoniteCoreWebOnline/wwwroot/js/sax-home.js | 2 +- SaxoniteCoreWebOnline/wwwroot/js/sax-main.js | 55 +- SaxoniteStandardBase/Base/App/Sax-Version.cs | 5 +- SaxoniteStandardBase/Base/App/Sax.cs | 17 +- .../Base/App/SaxDbDfn_Core.cs | 180 +++--- .../Base/App/SaxSystem-Statics.cs | 6 + SaxoniteStandardBase/Base/App/SaxSystem.cs | 2 + SaxoniteStandardBase/Base/Bus/SaxItemImage.cs | 300 ++++++++++ .../Base/Mgr/SaxItemDataMgr-ItemImage.cs | 214 +++++++ .../Dbas/Bus/SaxItemImage_Dbas.cs | 33 + .../Dbas/Internal/ActivityIndex_Db.cs | 2 +- .../Dbas/Internal/ItemImage_Db.cs | 260 ++++++++ .../Dbas/Internal/ItemSport_Db.cs | 2 +- .../Dbas/Internal/JournalistArticle_Db.cs | 2 +- .../Internal/OrganisationOpportunity_Db.cs | 2 +- .../Dbas/Internal/Organisation_Db.cs | 2 +- .../Dbas/Internal/Region_Db.cs | 2 +- .../Dbas/Internal/Sport_Db.cs | 2 +- .../Dbas/Internal/UserAccount_Db.cs | 2 +- .../Dbas/Internal/UserOrganisation_Db.cs | 2 +- .../Dbas/Internal/UserRole_Db.cs | 2 +- .../Dbas/Internal/UserSession_Db.cs | 2 +- .../Dbas/Internal/UserSport_Db.cs | 2 +- .../Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs | 564 ++++++++++++++++++ .../Resources/Database/SaxDbDfn_Core.xml | 424 +++++++++++++ 57 files changed, 2705 insertions(+), 199 deletions(-) create mode 100644 ReadMe.md create mode 100644 SaxoniteCoreWeb/Base/App/SaxyAuthenticationHandler.cs create mode 100644 SaxoniteCoreWeb/Base/Middleware/SaxAuthenticationHandler.cs create mode 100644 SaxoniteCoreWebOnline/Online/Controllers/AccountController-Image.cs create mode 100644 SaxoniteCoreWebOnline/wwwroot/img/animated/progress-basketball-32.gif create mode 100644 SaxoniteCoreWebOnline/wwwroot/img/animated/progress-basketball-64.gif create mode 100644 SaxoniteCoreWebOnline/wwwroot/img/animated/progress-cog-32.gif create mode 100644 SaxoniteCoreWebOnline/wwwroot/img/animated/progress-cog-64.gif create mode 100644 SaxoniteStandardBase/Base/Bus/SaxItemImage.cs create mode 100644 SaxoniteStandardBase/Base/Mgr/SaxItemDataMgr-ItemImage.cs create mode 100644 SaxoniteStandardDbas/Dbas/Bus/SaxItemImage_Dbas.cs create mode 100644 SaxoniteStandardDbas/Dbas/Internal/ItemImage_Db.cs create mode 100644 SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..c1f20a1 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,9 @@ +# Saxonite + +## Sarand - Wawam collaboration + +### Graphics + +#### Animated gifs + +* https://icons8.com/preloaders/ diff --git a/Saxonite.sln b/Saxonite.sln index df0a64b..64d1dac 100644 --- a/Saxonite.sln +++ b/Saxonite.sln @@ -26,8 +26,11 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaxoniteCoreUnitTests", "SaxoniteCoreUnitTests\SaxoniteCoreUnitTests.csproj", "{CA680625-E334-4F76-881B-1327A2F9FE86}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution files", "Solution files", "{BD66A338-2D41-4B64-86B0-670F4F42A489}" + ProjectSection(SolutionItems) = preProject + ReadMe.md = ReadMe.md + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaxoniteCoreUnitTestsOnline", "SaxoniteCoreUnitTestsOnline\SaxoniteCoreUnitTestsOnline.csproj", "{303BA8E9-1B95-41AD-9F51-32037A22C908}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaxoniteCoreUnitTestsOnline", "SaxoniteCoreUnitTestsOnline\SaxoniteCoreUnitTestsOnline.csproj", "{303BA8E9-1B95-41AD-9F51-32037A22C908}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/SaxoniteCoreWeb/Base/App/SaxStartup.cs b/SaxoniteCoreWeb/Base/App/SaxStartup.cs index 5513ab7..22f7361 100644 --- a/SaxoniteCoreWeb/Base/App/SaxStartup.cs +++ b/SaxoniteCoreWeb/Base/App/SaxStartup.cs @@ -59,6 +59,15 @@ namespace Saxonite.Net.Core.Web.Base.App } protected void ConfigureServices(ConfigureServicesConfig config) { + // Authentication service. + // Required to handle 'Forbidden' responses etc. + config.services + .AddAuthentication(options => { + options.DefaultAuthenticateScheme = "forbidScheme"; + options.DefaultForbidScheme = "forbidScheme"; + options.AddScheme("forbidScheme", "Handle Forbidden"); + }); + // Added to support memory caching of sessions. config.services.AddMemoryCache(); //config.services.AddDistributedMemoryCache(); - for multiple web servers. diff --git a/SaxoniteCoreWeb/Base/App/SaxyAuthenticationHandler.cs b/SaxoniteCoreWeb/Base/App/SaxyAuthenticationHandler.cs new file mode 100644 index 0000000..58d58ff --- /dev/null +++ b/SaxoniteCoreWeb/Base/App/SaxyAuthenticationHandler.cs @@ -0,0 +1,6 @@ +namespace Saxonite.Net.Core.Web.Base.App +{ + internal class SaxyAuthenticationHandler + { + } +} \ No newline at end of file diff --git a/SaxoniteCoreWeb/Base/Middleware/SaxAuthenticationHandler.cs b/SaxoniteCoreWeb/Base/Middleware/SaxAuthenticationHandler.cs new file mode 100644 index 0000000..e3fbae9 --- /dev/null +++ b/SaxoniteCoreWeb/Base/Middleware/SaxAuthenticationHandler.cs @@ -0,0 +1,46 @@ +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Net; +using System.Text; +using System.Text.Encodings.Web; +using System.Threading.Tasks; + +namespace Saxonite.Net.Core.Web.Base.Middleware +{ + //======================================================================= + // Authentication handler required to allow actions to issue Forbid() responses. + // Ref. https://stackoverflow.com/questions/54578426/why-do-i-need-to-set-a-defaultforbidscheme/54587054#54587054 + //======================================================================= + public class SaxAuthenticationHandler : AuthenticationHandler + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + public SaxAuthenticationHandler(IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : + base(options, logger, encoder, clock) + { + } + + //------------------------------------------------------------------- + protected override Task HandleForbiddenAsync(AuthenticationProperties properties) + { + Context.Response.StatusCode = (int)HttpStatusCode.Forbidden; + return base.HandleForbiddenAsync(properties); + } + + //------------------------------------------------------------------- + protected override async Task HandleAuthenticateAsync() + { + Context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; + return AuthenticateResult.NoResult(); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_User.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_User.cs index be4b6ac..e30bfaa 100644 --- a/SaxoniteCoreWebAdmin/Admin/Models/Model_User.cs +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_User.cs @@ -44,7 +44,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models public String UserFirstName { get; set; } public String UserLastName { get; set; } public String UserRoleCodeDelim = ","; - public List UserRoleCodes { get; set; } + public new List UserRoleCodes { get; set; } public List GetUserRoleCodes() { List codes = new List(); diff --git a/SaxoniteCoreWebAdmin/Views/Shared/_Layout.cshtml b/SaxoniteCoreWebAdmin/Views/Shared/_Layout.cshtml index b5895d5..5d6bc01 100644 --- a/SaxoniteCoreWebAdmin/Views/Shared/_Layout.cshtml +++ b/SaxoniteCoreWebAdmin/Views/Shared/_Layout.cshtml @@ -55,7 +55,7 @@ @* Scripts *@