Our.Umbraco.NodeDefender 1.1.0

.NET 5.0
There is a newer version of this package available.
See the version list below for details.
NuGet\Install-Package Our.Umbraco.NodeDefender -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Our.Umbraco.NodeDefender --version 1.1.0
<PackageReference Include="Our.Umbraco.NodeDefender" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Our.Umbraco.NodeDefender --version 1.1.0
#r "nuget: Our.Umbraco.NodeDefender, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Our.Umbraco.NodeDefender as a Cake Addin
#addin nuget:?package=Our.Umbraco.NodeDefender&version=1.1.0

// Install Our.Umbraco.NodeDefender as a Cake Tool
#tool nuget:?package=Our.Umbraco.NodeDefender&version=1.1.0

Our.Umbraco.NodeDefender

A no-nonsense approach to defending nodes. I often find myself writing the same thing in a lot of projects to prevent editors from renaming a settings node, or moving it to the recycle bin. This package aims to solve that simply.

The package has no dependencies as is configured in appsettings.json thus making it only usable on Umbraco 9+

Features

  • Prevent the duplication of nodes
  • Prevent the renaming of nodes
  • Prevent the deletion of nodes

Installation

Usage

To setup the NodeDefender, simply add a section to your appsettings.json called NodeDefender.

  "NodeDefender": {
    "AllowedUserGroups": [],
    "DenyRename": {},
    "DenyDuplicate": {},
    "DenyDelete": {}
  }

AllowedUserGroups

These are string aliases to the user groups of the users who are immune to the defender, remember, with great power comes great responsibility.

DenyOptions

DenyRename, DenyDuplicate and DenyDelete all share the same structure

{
  // an array of document string aliases
  "DoctypeAliases": [ 
    "homePage"
  ],
  // an array of specific node Ids
  "NodeIds": [
    1234
  ],
  // an array of specific node keys (as string)
  "NodeKeys: [
    "093b6805-db05-4510-96ac-e5ee8357d5e8"
  ],
  // an array of composition aliases 
  "CompositionAliases": [
    "myAwesomeComposition"
  ],
  // The error message to send
  "Message": {
    "Category": "Error",
    "Message": "You are not allowed to rename this node.",
    "Type": "Error" // Must be 'Error', 'Info', 'Warning' or 'Success'
  }
}

Full Example

  "NodeDefender": {
    "AllowedUserGroups": [
      "defenderImmune"
    ],
    "DenyRename": {
      "DoctypeAliases": [
        "homePage"
      ],
      "NodeIds": [
        1234
      ],
      "NodeKeys: [
        "093b6805-db05-4510-96ac-e5ee8357d5e8"
     ],
     "CompositionAliases": [
        "myAwesomeComposition"
      ],
      "Message": {
        "Category": "Error",
        "Message": "You are not allowed to rename this node.",
        "Type": "Error"
      }
    },
    "DenyDuplicate": {
      "DoctypeAliases": [
        "homePage"
      ],
      "NodeIds": [
        1234
      ]
    },
    "DenyDelete": {
      "DoctypeAliases": [
        "homePage"
      ],
      "NodeIds": [
        1234
      ]
    }
  }
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 177 6/20/2022
1.1.0 137 5/31/2022
1.0.0 193 5/31/2022