diff --git a/src/Umbraco.Core/Constants-UdiEntityType.cs b/src/Umbraco.Core/Constants-UdiEntityType.cs
index 81e64b534c..9c2a25b314 100644
--- a/src/Umbraco.Core/Constants-UdiEntityType.cs
+++ b/src/Umbraco.Core/Constants-UdiEntityType.cs
@@ -17,48 +17,42 @@ public static partial class Constants
// need to keep it around in a field nor to make it readonly
public const string Unknown = "unknown";
- // guid entity types
+ // GUID entity types
public const string AnyGuid = "any-guid"; // that one is for tests
-
- public const string Element = "element";
- public const string Document = "document";
-
- public const string DocumentBlueprint = "document-blueprint";
-
- public const string Media = "media";
- public const string Member = "member";
-
- public const string DictionaryItem = "dictionary-item";
- public const string Template = "template";
-
- public const string DocumentType = "document-type";
- public const string DocumentTypeContainer = "document-type-container";
-
- public const string DocumentBlueprintContainer = "document-blueprint-container";
- public const string MediaType = "media-type";
- public const string MediaTypeContainer = "media-type-container";
public const string DataType = "data-type";
public const string DataTypeContainer = "data-type-container";
- public const string MemberType = "member-type";
+ public const string DictionaryItem = "dictionary-item";
+ public const string Document = "document";
+ public const string DocumentBlueprint = "document-blueprint";
+ public const string DocumentBlueprintContainer = "document-blueprint-container";
+ public const string DocumentType = "document-type";
+ public const string DocumentTypeContainer = "document-type-container";
+ public const string Element = "element";
+ public const string Media = "media";
+ public const string MediaType = "media-type";
+ public const string MediaTypeContainer = "media-type-container";
+ public const string Member = "member";
public const string MemberGroup = "member-group";
-
+ public const string MemberType = "member-type";
+ public const string Relation = "relation";
public const string RelationType = "relation-type";
-
+ public const string Template = "template";
+ public const string User = "user";
+ public const string UserGroup = "user-group";
public const string Webhook = "webhook";
- // forms
- public const string FormsForm = "forms-form";
- public const string FormsPreValue = "forms-prevalue";
- public const string FormsDataSource = "forms-datasource";
-
- // string entity types
+ // String entity types
public const string AnyString = "any-string"; // that one is for tests
-
public const string Language = "language";
public const string MediaFile = "media-file";
- public const string TemplateFile = "template-file";
+ public const string PartialView = "partial-view";
public const string Script = "script";
public const string Stylesheet = "stylesheet";
- public const string PartialView = "partial-view";
+ public const string TemplateFile = "template-file";
+
+ // Forms entity types
+ public const string FormsDataSource = "forms-datasource";
+ public const string FormsForm = "forms-form";
+ public const string FormsPreValue = "forms-prevalue";
}
}
diff --git a/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs b/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs
index 66c5002604..a5adc0de2a 100644
--- a/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs
+++ b/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs
@@ -4,6 +4,7 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Entities;
+using Umbraco.Cms.Core.Models.Membership;
namespace Umbraco.Extensions;
@@ -27,8 +28,6 @@ public static class UdiGetterExtensions
{
// Concrete types
EntityContainer container => container.GetUdi(),
- Script script => script.GetUdi(),
- Stylesheet stylesheet => stylesheet.GetUdi(),
// Interfaces
IContentBase contentBase => contentBase.GetUdi(),
IContentTypeComposition contentTypeComposition => contentTypeComposition.GetUdi(),
@@ -37,8 +36,13 @@ public static class UdiGetterExtensions
ILanguage language => language.GetUdi(),
IMemberGroup memberGroup => memberGroup.GetUdi(),
IPartialView partialView => partialView.GetUdi(),
+ IRelation relation => relation.GetUdi(),
IRelationType relationType => relationType.GetUdi(),
+ IScript script => script.GetUdi(),
+ IStylesheet stylesheet => stylesheet.GetUdi(),
ITemplate template => template.GetUdi(),
+ IUser user => user.GetUdi(),
+ IUserGroup userGroup => userGroup.GetUdi(),
IWebhook webhook => webhook.GetUdi(),
_ => throw new NotSupportedException($"Entity type {entity.GetType().FullName} is not supported."),
};
@@ -80,34 +84,6 @@ public static class UdiGetterExtensions
return new GuidUdi(entityType, entity.Key).EnsureClosed();
}
- ///
- /// Gets the entity identifier of the entity.
- ///
- /// The entity.
- ///
- /// The entity identifier of the entity.
- ///
- public static StringUdi GetUdi(this Script entity)
- {
- ArgumentNullException.ThrowIfNull(entity);
-
- return GetUdiFromPath(Constants.UdiEntityType.Script, entity.Path);
- }
-
- ///
- /// Gets the entity identifier of the entity.
- ///
- /// The entity.
- ///
- /// The entity identifier of the entity.
- ///
- public static StringUdi GetUdi(this Stylesheet entity)
- {
- ArgumentNullException.ThrowIfNull(entity);
-
- return GetUdiFromPath(Constants.UdiEntityType.Stylesheet, entity.Path);
- }
-
///
/// Gets the entity identifier of the entity.
///
@@ -304,6 +280,20 @@ public static class UdiGetterExtensions
return GetUdiFromPath(Constants.UdiEntityType.PartialView, entity.Path);
}
+ ///
+ /// Gets the entity identifier of the entity.
+ ///
+ /// The entity.
+ ///
+ /// The entity identifier of the entity.
+ ///
+ public static GuidUdi GetUdi(this IRelation entity)
+ {
+ ArgumentNullException.ThrowIfNull(entity);
+
+ return new GuidUdi(Constants.UdiEntityType.Relation, entity.Key).EnsureClosed();
+ }
+
///
/// Gets the entity identifier of the entity.
///
@@ -318,6 +308,34 @@ public static class UdiGetterExtensions
return new GuidUdi(Constants.UdiEntityType.RelationType, entity.Key).EnsureClosed();
}
+ ///
+ /// Gets the entity identifier of the entity.
+ ///
+ /// The entity.
+ ///
+ /// The entity identifier of the entity.
+ ///
+ public static StringUdi GetUdi(this IScript entity)
+ {
+ ArgumentNullException.ThrowIfNull(entity);
+
+ return GetUdiFromPath(Constants.UdiEntityType.Script, entity.Path);
+ }
+
+ ///
+ /// Gets the entity identifier of the entity.
+ ///
+ /// The entity.
+ ///
+ /// The entity identifier of the entity.
+ ///
+ public static StringUdi GetUdi(this IStylesheet entity)
+ {
+ ArgumentNullException.ThrowIfNull(entity);
+
+ return GetUdiFromPath(Constants.UdiEntityType.Stylesheet, entity.Path);
+ }
+
///
/// Gets the entity identifier of the entity.
///
@@ -332,6 +350,34 @@ public static class UdiGetterExtensions
return new GuidUdi(Constants.UdiEntityType.Template, entity.Key).EnsureClosed();
}
+ ///
+ /// Gets the entity identifier of the entity.
+ ///
+ /// The entity.
+ ///
+ /// The entity identifier of the entity.
+ ///
+ public static GuidUdi GetUdi(this IUser entity)
+ {
+ ArgumentNullException.ThrowIfNull(entity);
+
+ return new GuidUdi(Constants.UdiEntityType.User, entity.Key).EnsureClosed();
+ }
+
+ ///
+ /// Gets the entity identifier of the entity.
+ ///
+ /// The entity.
+ ///
+ /// The entity identifier of the entity.
+ ///
+ public static GuidUdi GetUdi(this IUserGroup entity)
+ {
+ ArgumentNullException.ThrowIfNull(entity);
+
+ return new GuidUdi(Constants.UdiEntityType.UserGroup, entity.Key).EnsureClosed();
+ }
+
///
/// Gets the entity identifier of the entity.
///
diff --git a/src/Umbraco.Core/UdiParser.cs b/src/Umbraco.Core/UdiParser.cs
index 24ee238a69..ed1f16ae28 100644
--- a/src/Umbraco.Core/UdiParser.cs
+++ b/src/Umbraco.Core/UdiParser.cs
@@ -200,34 +200,40 @@ public sealed class UdiParser
new()
{
{ Constants.UdiEntityType.Unknown, UdiType.Unknown },
+ // GUID UDI types
{ Constants.UdiEntityType.AnyGuid, UdiType.GuidUdi },
- { Constants.UdiEntityType.Element, UdiType.GuidUdi },
+ { Constants.UdiEntityType.DataType, UdiType.GuidUdi },
+ { Constants.UdiEntityType.DataTypeContainer, UdiType.GuidUdi },
+ { Constants.UdiEntityType.DictionaryItem, UdiType.GuidUdi },
{ Constants.UdiEntityType.Document, UdiType.GuidUdi },
{ Constants.UdiEntityType.DocumentBlueprint, UdiType.GuidUdi },
{ Constants.UdiEntityType.DocumentBlueprintContainer, UdiType.GuidUdi },
- { Constants.UdiEntityType.Media, UdiType.GuidUdi },
- { Constants.UdiEntityType.Member, UdiType.GuidUdi },
- { Constants.UdiEntityType.DictionaryItem, UdiType.GuidUdi },
- { Constants.UdiEntityType.Template, UdiType.GuidUdi },
{ Constants.UdiEntityType.DocumentType, UdiType.GuidUdi },
{ Constants.UdiEntityType.DocumentTypeContainer, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Element, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Media, UdiType.GuidUdi },
{ Constants.UdiEntityType.MediaType, UdiType.GuidUdi },
{ Constants.UdiEntityType.MediaTypeContainer, UdiType.GuidUdi },
- { Constants.UdiEntityType.DataType, UdiType.GuidUdi },
- { Constants.UdiEntityType.DataTypeContainer, UdiType.GuidUdi },
- { Constants.UdiEntityType.MemberType, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Member, UdiType.GuidUdi },
{ Constants.UdiEntityType.MemberGroup, UdiType.GuidUdi },
+ { Constants.UdiEntityType.MemberType, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Relation, UdiType.GuidUdi },
{ Constants.UdiEntityType.RelationType, UdiType.GuidUdi },
- { Constants.UdiEntityType.FormsForm, UdiType.GuidUdi },
- { Constants.UdiEntityType.FormsPreValue, UdiType.GuidUdi },
- { Constants.UdiEntityType.FormsDataSource, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Template, UdiType.GuidUdi },
+ { Constants.UdiEntityType.User, UdiType.GuidUdi },
+ { Constants.UdiEntityType.UserGroup, UdiType.GuidUdi },
+ { Constants.UdiEntityType.Webhook, UdiType.GuidUdi },
+ // String UDI types
{ Constants.UdiEntityType.AnyString, UdiType.StringUdi },
{ Constants.UdiEntityType.Language, UdiType.StringUdi },
{ Constants.UdiEntityType.MediaFile, UdiType.StringUdi },
- { Constants.UdiEntityType.TemplateFile, UdiType.StringUdi },
- { Constants.UdiEntityType.Script, UdiType.StringUdi },
{ Constants.UdiEntityType.PartialView, UdiType.StringUdi },
+ { Constants.UdiEntityType.Script, UdiType.StringUdi },
{ Constants.UdiEntityType.Stylesheet, UdiType.StringUdi },
- { Constants.UdiEntityType.Webhook, UdiType.GuidUdi },
+ { Constants.UdiEntityType.TemplateFile, UdiType.StringUdi },
+ // Forms UDI types
+ { Constants.UdiEntityType.FormsDataSource, UdiType.GuidUdi },
+ { Constants.UdiEntityType.FormsForm, UdiType.GuidUdi },
+ { Constants.UdiEntityType.FormsPreValue, UdiType.GuidUdi },
};
}
diff --git a/src/Umbraco.Core/UdiParserServiceConnectors.cs b/src/Umbraco.Core/UdiParserServiceConnectors.cs
index 4c307435de..465431476e 100644
--- a/src/Umbraco.Core/UdiParserServiceConnectors.cs
+++ b/src/Umbraco.Core/UdiParserServiceConnectors.cs
@@ -4,6 +4,7 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Core;
+[Obsolete("This class will be removed in a future version.")]
public static class UdiParserServiceConnectors
{
private static readonly object ScanLocker = new();
@@ -19,6 +20,7 @@ public static class UdiParserServiceConnectors
/// Scan for deploy in assemblies for known UDI types.
///
///
+ [Obsolete("Use UdiParser.RegisterUdiType() instead. This method will be removed in a future version.")]
public static void ScanDeployServiceConnectorsForUdiTypes(TypeLoader typeLoader)
{
if (typeLoader is null)
@@ -72,6 +74,7 @@ public static class UdiParserServiceConnectors
/// Registers a single to add it's UDI type.
///
///
+ [Obsolete("Use UdiParser.RegisterUdiType() instead. This method will be removed in a future version.")]
public static void RegisterServiceConnector()
where T : IServiceConnector
{
diff --git a/tests/Umbraco.Tests.Common/Builders/UserGroupBuilder.cs b/tests/Umbraco.Tests.Common/Builders/UserGroupBuilder.cs
index 97288789b7..c84b118abe 100644
--- a/tests/Umbraco.Tests.Common/Builders/UserGroupBuilder.cs
+++ b/tests/Umbraco.Tests.Common/Builders/UserGroupBuilder.cs
@@ -1,8 +1,6 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
-using System.Collections.Generic;
-using System.Linq;
using Moq;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Strings;
@@ -22,6 +20,7 @@ public class UserGroupBuilder : UserGroupBuilder