-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [AMEND] Change namespacing - [AMEND] Rework Startup Integrations - [FIX] Fix Migration execution flow - [AMEND] Split into Main and Core Projects - [FIX] Bugs with rendering
- Loading branch information
Nik Rimington
committed
Jul 23, 2021
1 parent
faf7317
commit 6dc605c
Showing
31 changed files
with
742 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Bjarke Berg | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Page Not Found Manager | ||
|
||
<img src="docs/img/logo.png?raw=true" alt="Page not found" width="250" align="right" /> | ||
|
||
[](https://www.nuget.org/packages/HotChilli.Umbraco.PageNotFound/) | ||
[](https://our.umbraco.com/packages/backoffice-extensions/hot-chilli-page-not-found-manager/) | ||
|
||
## Getting Started | ||
|
||
**This is currently a beta package** | ||
|
||
Page Not Found Manager supports Umbraco v9 RC1+. | ||
|
||
Umbraco v9 Packages are only available via Nuget, although there is a page on [Our.Umbraco.com](https://our.umbraco.com/packages/backoffice-extensions/hot-chilli-page-not-found-manager/) to aid discoverability. | ||
|
||
## Installation | ||
|
||
To [install from NuGet](https://www.nuget.org/packages/HotChilli.Umbraco.PageNotFound/), run the following command in your instance of Visual Studio. | ||
|
||
PM> Install-Package HotChilli.Umbraco.PageNotFound | ||
|
||
## Credits | ||
|
||
The logo uses [404](https://thenounproject.com/term/404/3283006 ) from the [Noun Project](https://thenounproject.com) by [Ilham Fitrotul Hayat](https://thenounproject.com/fhilham), licensed under [CC BY 3.0 US](https://creativecommons.org/licenses/by/3.0/us/). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Ignore Umbraco files/folders generated for each instance | ||
## | ||
## Get latest from https://github.com/github/gitignore/blob/master/Umbraco.gitignore | ||
|
||
# Note: VisualStudio gitignore rules may also be relevant | ||
|
||
# Umbraco | ||
# Ignore unimportant folders generated by Umbraco | ||
**/App_Data/Logs/ | ||
**/App_Data/[Pp]review/ | ||
**/App_Data/TEMP/ | ||
**/App_Data/NuGetBackup/ | ||
|
||
# Ignore Umbraco content cache file | ||
**/App_Data/umbraco.config | ||
|
||
## this [Uu]mbraco/ folder should be created by cmd like `Install-Package UmbracoCms -Version 8.5.3` | ||
## you can find your Umbraco version in your Web.config. (i.e. <add key="Umbraco.Core.ConfigurationStatus" value="8.5.3" />) | ||
## Uncomment this line if you think it fits the way you work on your project. | ||
## **/[Uu]mbraco/ | ||
|
||
# Don't ignore Umbraco packages (VisualStudio.gitignore mistakes this for a NuGet packages folder) | ||
# Make sure to include details from VisualStudio.gitignore BEFORE this | ||
!**/App_Data/[Pp]ackages/* | ||
!**/[Uu]mbraco/[Dd]eveloper/[Pp]ackages/* | ||
!**/[Uu]mbraco/[Vv]iews/[Pp]ackages/* | ||
|
||
# ImageProcessor DiskCache | ||
**/App_Data/cache/ | ||
|
||
# Ignore the Models Builder models out of date flag | ||
**/ood.flag | ||
|
||
# NEW for version 9 .Net 5 (Core) | ||
# Umbraco 9 now stores it's unimportant folders within the umbraco directory | ||
**/[Uu]mbraco/Data/* | ||
# we want to keep the packages directory | ||
!**/[Uu]mbraco/Data/[Pp]ackages/* | ||
**/[Uu]mbraco/Logs/* | ||
**/[Uu]mbraco/mediacache/* | ||
**/wwwroot/umbraco/* |
8 changes: 4 additions & 4 deletions
8
...FoundManager/Backoffice/MenuController.cs → ...Manager.Core/Backoffice/MenuController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/HC.PageNotFoundManager.Core/Backoffice/MenuRenderingNotificationHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using HC.PageNotFoundManager.Core.Config; | ||
using Microsoft.Extensions.Options; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Umbraco.Cms.Core.Events; | ||
using Umbraco.Cms.Core.Models.Trees; | ||
using Umbraco.Cms.Core.Notifications; | ||
using Umbraco.Cms.Core.Security; | ||
using Umbraco.Extensions; | ||
|
||
namespace HC.PageNotFoundManager.Core.Backoffice | ||
{ | ||
public class MenuRenderingNotificationHandler : INotificationHandler<MenuRenderingNotification> | ||
{ | ||
private readonly List<string> UserGroupNames; | ||
private readonly IBackOfficeSecurityAccessor backOfficeSecurity; | ||
|
||
public MenuRenderingNotificationHandler(IOptions<PageNotFound> settings, IBackOfficeSecurityAccessor backOfficeSecurity) | ||
{ | ||
if (settings is null) throw new System.ArgumentNullException(nameof(settings)); | ||
|
||
UserGroupNames = new List<string> { Umbraco.Cms.Core.Constants.Security.AdminGroupAlias }; | ||
if (settings.Value.UserGroups != null && settings.Value.UserGroups.Length > 0) | ||
UserGroupNames.AddRange(settings.Value.UserGroups); | ||
this.backOfficeSecurity = backOfficeSecurity ?? throw new System.ArgumentNullException(nameof(backOfficeSecurity)); | ||
} | ||
|
||
public void Handle(MenuRenderingNotification notification) | ||
{ | ||
if (notification.TreeAlias != Umbraco.Cms.Core.Constants.Trees.Content | ||
&& int.TryParse(notification.NodeId, out var nodeId) && nodeId <= 0) return; | ||
|
||
if (backOfficeSecurity.BackOfficeSecurity.CurrentUser == null) return; | ||
|
||
if (backOfficeSecurity.BackOfficeSecurity.CurrentUser.Groups == null || | ||
backOfficeSecurity.BackOfficeSecurity.CurrentUser.Groups.All(g => !UserGroupNames.InvariantContains(g.Alias))) return; | ||
|
||
var menuItem = new MenuItem(Constants.MenuAlias, Constants.MenuLabel) | ||
{ | ||
Icon = Umbraco.Cms.Core.Constants.Icons.Content, | ||
SeparatorBefore = true | ||
}; | ||
|
||
menuItem.LaunchDialogView("/App_Plugins/HC.PageNotFound/Backoffice/Dialogs/dialog.html", Constants.MenuLabel); | ||
|
||
notification.Menu.Items.Add(menuItem); | ||
|
||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/HC.PageNotFoundManager.Core/Backoffice/PageNotFoundDialogControllerFile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Umbraco.Cms.Core.WebAssets; | ||
|
||
namespace HC.PageNotFoundManager.Core.Backoffice | ||
{ | ||
public class PageNotFoundDialogControllerFile : JavaScriptFile | ||
{ | ||
public PageNotFoundDialogControllerFile() : base("/App_Plugins/HC.PageNotFound/js/dialog.controller.js") | ||
{ | ||
|
||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/HC.PageNotFoundManager.Core/Backoffice/PageNotFoundResourceFile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Umbraco.Cms.Core.WebAssets; | ||
|
||
namespace HC.PageNotFoundManager.Core.Backoffice | ||
{ | ||
public class PageNotFoundResourceFile : JavaScriptFile | ||
{ | ||
public PageNotFoundResourceFile() : base("/App_Plugins/HC.PageNotFound/js/resource.js") | ||
{ | ||
|
||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...NotFoundManager/Caching/CacheRefresher.cs → ...undManager.Core/Caching/CacheRefresher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ger/Caching/DistributedCacheExtensions.cs → ...ore/Caching/DistributedCacheExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace HC.PageNotFoundManager.Core.Config | ||
{ | ||
/// <summary> | ||
/// Class to represent the settings from appsettings | ||
/// </summary> | ||
public class PageNotFound | ||
{ | ||
public PageNotFound() | ||
{ | ||
UserGroups = Array.Empty<string>(); | ||
} | ||
public string[] UserGroups { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace HC.PageNotFoundManager.Core | ||
{ | ||
public static class Constants | ||
{ | ||
public const string Base = "HCS"; | ||
public const string BackOffice = Base + "PageNotFound"; | ||
|
||
public const string MenuAlias = "pageNotFoundManagement"; | ||
public const string MenuLabel = "Manage 404 Page"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/HC.PageNotFoundManager.Core/HC.PageNotFoundManager.Core.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyVersion>1.0.0</AssemblyVersion> | ||
<Version>1.0.0</Version> | ||
<InformationalVersion>1.0.0</InformationalVersion> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<Authors>Nik Rimington</Authors> | ||
<ContentTargetFolders>.</ContentTargetFolders> | ||
<Product>HotChilli.Umbraco.PageNotFound.Core</Product> | ||
<PackageId>HotChilli.Umbraco.PageNotFound.Core</PackageId> | ||
<Title>HotChilli.Umbraco.PageNotFound.Core</Title> | ||
<Description>Umbraco package for setting 404 response pages </Description> | ||
<Product>HotChilli.Umbraco.PageNotFound.Core</Product> | ||
<PackageTags>umbraco plugin package</PackageTags> | ||
<PackageProjectUrl>https://github.com/NikRimington/HCS.Umbraco.PageNotFoundManager</PackageProjectUrl> | ||
<PackageIcon>logo.png</PackageIcon> | ||
<PackageIconUrl>https://raw.githubusercontent.com/NikRimington/HCS.Umbraco.PageNotFoundManager/main/docs/img/logo.png</PackageIconUrl> | ||
<RepositoryUrl>https://github.com/NikRimington/HCS.Umbraco.PageNotFoundManager</RepositoryUrl> | ||
<RepositoryType>Git</RepositoryType> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc001" /> | ||
<PackageReference Include="Umbraco.Cms.Infrastructure" Version="9.0.0-rc001" /> | ||
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="9.0.0-rc001" /> | ||
<PackageReference Include="Umbraco.Cms.Web.Common" Version="9.0.0-rc001" /> | ||
<PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0-rc001" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="../../docs/img/logo.png" Pack="true" PackPath="\" /> | ||
<None Include="../../LICENSE" Pack="true" PackPath="" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.