From ec56778c9f23c120b6b0df7709e1b3e124e8fe2e Mon Sep 17 00:00:00 2001 From: Matthew Wise <6782865+Matthew-Wise@users.noreply.github.com> Date: Sat, 22 Oct 2022 15:10:13 +0100 Subject: [PATCH] standarising ActionLetter and ActionName for IAction --- .../Actions/ActionAssignDomain.cs | 14 ++++++------- src/Umbraco.Core/Actions/ActionBrowse.cs | 14 +++++++------ src/Umbraco.Core/Actions/ActionCopy.cs | 15 +++++++------- .../ActionCreateBlueprintFromContent.cs | 16 ++++++++++----- src/Umbraco.Core/Actions/ActionDelete.cs | 14 +++++-------- src/Umbraco.Core/Actions/ActionMove.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionNew.cs | 20 ++++++++----------- src/Umbraco.Core/Actions/ActionNotify.cs | 20 ++++++++++++------- src/Umbraco.Core/Actions/ActionProtect.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionPublish.cs | 15 +++++++------- src/Umbraco.Core/Actions/ActionRestore.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionRights.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionRollback.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionSort.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionToPublish.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionUnpublish.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/ActionUpdate.cs | 17 ++++++++-------- src/Umbraco.Core/Actions/IAction.cs | 11 ++++++++-- 18 files changed, 158 insertions(+), 134 deletions(-) diff --git a/src/Umbraco.Core/Actions/ActionAssignDomain.cs b/src/Umbraco.Core/Actions/ActionAssignDomain.cs index 3bd946837f..7ef7b9ca83 100644 --- a/src/Umbraco.Core/Actions/ActionAssignDomain.cs +++ b/src/Umbraco.Core/Actions/ActionAssignDomain.cs @@ -8,17 +8,17 @@ namespace Umbraco.Cms.Core.Actions; /// public class ActionAssignDomain : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'I'; - /// + /// + public const string ActionAlias = "assigndomain"; + + /// public char Letter => ActionLetter; - /// - // This is all lower-case because of case sensitive filesystems, see issue: https://github.com/umbraco/Umbraco-CMS/issues/11670 - public string Alias => "assigndomain"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; diff --git a/src/Umbraco.Core/Actions/ActionBrowse.cs b/src/Umbraco.Core/Actions/ActionBrowse.cs index 2620888a30..ff217ac43a 100644 --- a/src/Umbraco.Core/Actions/ActionBrowse.cs +++ b/src/Umbraco.Core/Actions/ActionBrowse.cs @@ -16,14 +16,18 @@ namespace Umbraco.Cms.Core.Actions; /// public class ActionBrowse : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'F'; - /// + /// + public const string ActionAlias = "browse"; + + /// public char Letter => ActionLetter; + /// + public string Alias => ActionAlias; + /// public bool ShowInNotifier => false; @@ -33,8 +37,6 @@ public class ActionBrowse : IAction /// public string Icon => string.Empty; - /// - public string Alias => "browse"; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/ActionCopy.cs b/src/Umbraco.Core/Actions/ActionCopy.cs index f7d9d699a5..f4afb3906c 100644 --- a/src/Umbraco.Core/Actions/ActionCopy.cs +++ b/src/Umbraco.Core/Actions/ActionCopy.cs @@ -1,4 +1,4 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; @@ -8,16 +8,17 @@ namespace Umbraco.Cms.Core.Actions; /// public class ActionCopy : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'O'; - /// + /// + public const string ActionAlias = "copy"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "copy"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.StructureCategory; diff --git a/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs b/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs index ee249d9ef8..f23e5cac84 100644 --- a/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs +++ b/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs @@ -8,8 +8,17 @@ namespace Umbraco.Cms.Core.Actions; /// public class ActionCreateBlueprintFromContent : IAction { - /// - public char Letter => 'ï'; + /// + public const char ActionLetter = 'ï'; + + /// + public const string ActionAlias = "createblueprint"; + + /// + public char Letter => ActionLetter; + + /// + public string Alias => ActionAlias; /// public bool ShowInNotifier => false; @@ -20,9 +29,6 @@ public class ActionCreateBlueprintFromContent : IAction /// public string Icon => Constants.Icons.Blueprint; - /// - public string Alias => "createblueprint"; - /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionDelete.cs b/src/Umbraco.Core/Actions/ActionDelete.cs index 055b2a8f98..ea8517c794 100644 --- a/src/Umbraco.Core/Actions/ActionDelete.cs +++ b/src/Umbraco.Core/Actions/ActionDelete.cs @@ -1,4 +1,4 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; @@ -8,16 +8,12 @@ namespace Umbraco.Cms.Core.Actions; /// public class ActionDelete : IAction { - /// - /// The unique action alias - /// - public const string ActionAlias = "delete"; - - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'D'; + /// + public const string ActionAlias = "delete"; + /// public char Letter => ActionLetter; diff --git a/src/Umbraco.Core/Actions/ActionMove.cs b/src/Umbraco.Core/Actions/ActionMove.cs index c1f6089793..a145e86fab 100644 --- a/src/Umbraco.Core/Actions/ActionMove.cs +++ b/src/Umbraco.Core/Actions/ActionMove.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked upon creation of a document, media, member +/// This action is invoked upon creation of a document, media, member. /// public class ActionMove : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'M'; - /// + /// + public const string ActionAlias = "move"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "move"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.StructureCategory; diff --git a/src/Umbraco.Core/Actions/ActionNew.cs b/src/Umbraco.Core/Actions/ActionNew.cs index bd08a95ac5..25ac603532 100644 --- a/src/Umbraco.Core/Actions/ActionNew.cs +++ b/src/Umbraco.Core/Actions/ActionNew.cs @@ -1,27 +1,23 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked upon creation of a document +/// This action is invoked upon creation of a document. /// public class ActionNew : IAction { - /// - /// The unique action alias - /// - public const string ActionAlias = "create"; - - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'C'; - /// + /// + public const string ActionAlias = "create"; + + /// public char Letter => ActionLetter; - /// + /// public string Alias => ActionAlias; /// diff --git a/src/Umbraco.Core/Actions/ActionNotify.cs b/src/Umbraco.Core/Actions/ActionNotify.cs index 10845b01b9..8ad650a74a 100644 --- a/src/Umbraco.Core/Actions/ActionNotify.cs +++ b/src/Umbraco.Core/Actions/ActionNotify.cs @@ -1,15 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked upon modifying the notification of a content +/// This action is invoked upon modifying the notification of a content. /// public class ActionNotify : IAction { - /// - public char Letter => 'N'; + /// + public const char ActionLetter = 'N'; + + /// + public const string ActionAlias = "notify"; + + /// + public char Letter => ActionLetter; + + /// + public string Alias => ActionAlias; /// public bool ShowInNotifier => false; @@ -20,9 +29,6 @@ public class ActionNotify : IAction /// public string Icon => "icon-megaphone"; - /// - public string Alias => "notify"; - /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionProtect.cs b/src/Umbraco.Core/Actions/ActionProtect.cs index 7b54a0ec98..21c985961b 100644 --- a/src/Umbraco.Core/Actions/ActionProtect.cs +++ b/src/Umbraco.Core/Actions/ActionProtect.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when a document is protected or unprotected +/// This action is invoked when a document is protected or unprotected. /// public class ActionProtect : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'P'; - /// + /// + public const string ActionAlias = "protect"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "protect"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; diff --git a/src/Umbraco.Core/Actions/ActionPublish.cs b/src/Umbraco.Core/Actions/ActionPublish.cs index e07b0935bc..09f6c831e9 100644 --- a/src/Umbraco.Core/Actions/ActionPublish.cs +++ b/src/Umbraco.Core/Actions/ActionPublish.cs @@ -4,20 +4,21 @@ namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when a document is being published +/// This action is invoked when a document is being published. /// public class ActionPublish : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'U'; - /// + /// + public const string ActionAlias = "publish"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "publish"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/ActionRestore.cs b/src/Umbraco.Core/Actions/ActionRestore.cs index 395c678fe4..dcdfc86521 100644 --- a/src/Umbraco.Core/Actions/ActionRestore.cs +++ b/src/Umbraco.Core/Actions/ActionRestore.cs @@ -1,22 +1,23 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when the content/media item is to be restored from the recycle bin +/// This action is invoked when the content/media item is to be restored from the recycle bin. /// public class ActionRestore : IAction { - /// - /// The unique action alias - /// + /// + public const char ActionLetter = 'V'; + + /// public const string ActionAlias = "restore"; - /// - public char Letter => 'V'; + /// + public char Letter => ActionLetter; - /// + /// public string Alias => ActionAlias; /// diff --git a/src/Umbraco.Core/Actions/ActionRights.cs b/src/Umbraco.Core/Actions/ActionRights.cs index 4cd8674122..7e493d6c16 100644 --- a/src/Umbraco.Core/Actions/ActionRights.cs +++ b/src/Umbraco.Core/Actions/ActionRights.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when rights are changed on a document +/// This action is invoked when rights are changed on a document. /// public class ActionRights : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'R'; - /// + /// + public const string ActionAlias = "rights"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "rights"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/ActionRollback.cs b/src/Umbraco.Core/Actions/ActionRollback.cs index 63021a2ae3..7e1dab6467 100644 --- a/src/Umbraco.Core/Actions/ActionRollback.cs +++ b/src/Umbraco.Core/Actions/ActionRollback.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when copying a document is being rolled back +/// This action is invoked when copying a document is being rolled back. /// public class ActionRollback : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'K'; - /// + /// + public const string ActionAlias = "rollback"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "rollback"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; diff --git a/src/Umbraco.Core/Actions/ActionSort.cs b/src/Umbraco.Core/Actions/ActionSort.cs index 23e65d7533..4f90e404c8 100644 --- a/src/Umbraco.Core/Actions/ActionSort.cs +++ b/src/Umbraco.Core/Actions/ActionSort.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when children to a document, media, member is being sorted +/// This action is invoked when children to a document, media, member is being sorted. /// public class ActionSort : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'S'; - /// + /// + public const string ActionAlias = "sort"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "sort"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.StructureCategory; diff --git a/src/Umbraco.Core/Actions/ActionToPublish.cs b/src/Umbraco.Core/Actions/ActionToPublish.cs index 8df53b3e4a..e7af16bc99 100644 --- a/src/Umbraco.Core/Actions/ActionToPublish.cs +++ b/src/Umbraco.Core/Actions/ActionToPublish.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when children to a document is being sent to published (by an editor without publishrights) +/// This action is invoked when children to a document is being sent to published (by an editor without publishrights). /// public class ActionToPublish : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'H'; - /// + /// + public const string ActionAlias = "sendtopublish"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "sendtopublish"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/ActionUnpublish.cs b/src/Umbraco.Core/Actions/ActionUnpublish.cs index f8ebb918f9..f10159b403 100644 --- a/src/Umbraco.Core/Actions/ActionUnpublish.cs +++ b/src/Umbraco.Core/Actions/ActionUnpublish.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when a document is being unpublished +/// This action is invoked when a document is being unpublished. /// public class ActionUnpublish : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'Z'; - /// + /// + public const string ActionAlias = "unpublish"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "unpublish"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/ActionUpdate.cs b/src/Umbraco.Core/Actions/ActionUpdate.cs index 2d01ef176c..aa6b0e9950 100644 --- a/src/Umbraco.Core/Actions/ActionUpdate.cs +++ b/src/Umbraco.Core/Actions/ActionUpdate.cs @@ -1,23 +1,24 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. namespace Umbraco.Cms.Core.Actions; /// -/// This action is invoked when copying a document or media +/// This action is invoked when copying a document or media. /// public class ActionUpdate : IAction { - /// - /// The unique action letter - /// + /// public const char ActionLetter = 'A'; - /// + /// + public const string ActionAlias = "update"; + + /// public char Letter => ActionLetter; - /// - public string Alias => "update"; + /// + public string Alias => ActionAlias; /// public string Category => Constants.Conventions.PermissionCategories.ContentCategory; diff --git a/src/Umbraco.Core/Actions/IAction.cs b/src/Umbraco.Core/Actions/IAction.cs index f57e697a2e..6afe147e69 100644 --- a/src/Umbraco.Core/Actions/IAction.cs +++ b/src/Umbraco.Core/Actions/IAction.cs @@ -13,8 +13,14 @@ namespace Umbraco.Cms.Core.Actions; /// public interface IAction : IDiscoverable { + /// + const char ActionLetter = default; + + /// + const string ActionAlias = default; + /// - /// Gets the letter used to assign a permission (must be unique) + /// Gets the letter used to assign a permission (must be unique). /// char Letter { get; } @@ -34,7 +40,8 @@ public interface IAction : IDiscoverable string Icon { get; } /// - /// Gets the alias for this action (must be unique) + /// Gets the alias for this action (must be unique). + /// This is all lower-case because of case sensitive filesystems, see issue: https://github.com/umbraco/Umbraco-CMS/issues/11670. /// string Alias { get; }