Moves as much as possible from Models/Packaging, Models/PublishedContent, Models/Entities, Models/Membership
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using Umbraco.Core.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a content app badge
|
||||
/// </summary>
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
// TODO: This was marked with `[StringEnumConverter]` to inform the serializer
|
||||
// to serialize the values to string instead of INT (which is the default)
|
||||
// so we need to either invent our own attribute and make the implementation aware of it
|
||||
// or ... something else?
|
||||
|
||||
/// <summary>
|
||||
/// Represent the content app badge types
|
||||
/// </summary>
|
||||
[DataContract(Name = "contentAppBadgeType")]
|
||||
public enum ContentAppBadgeType
|
||||
{
|
||||
[EnumMember(Value = "default")]
|
||||
Default = 0,
|
||||
|
||||
[EnumMember(Value = "warning")]
|
||||
Warning = 1,
|
||||
|
||||
[EnumMember(Value = "alert")]
|
||||
Alert = 2
|
||||
}
|
||||
}
|
||||
@@ -80,37 +80,7 @@ namespace Umbraco.Core.Models.Entities
|
||||
_id = default;
|
||||
_key = Guid.Empty;
|
||||
_hasIdentity = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the entity when it is being saved for the first time.
|
||||
/// </summary>
|
||||
internal virtual void AddingEntity()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
// set the create and update dates, if not already set
|
||||
if (IsPropertyDirty("CreateDate") == false || _createDate == default)
|
||||
CreateDate = now;
|
||||
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
|
||||
UpdateDate = now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the entity when it is being saved.
|
||||
/// </summary>
|
||||
internal virtual void UpdatingEntity()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
// just in case
|
||||
if (_createDate == default)
|
||||
CreateDate = now;
|
||||
|
||||
// set the update date if not already set
|
||||
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
|
||||
UpdateDate = now;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Equals(EntityBase other)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace Umbraco.Core.Models.Entities
|
||||
{
|
||||
internal static class EntityExtensions
|
||||
public static class EntityExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates the entity when it is being saved.
|
||||
/// </summary>
|
||||
internal static void UpdatingEntity(this IEntity entity)
|
||||
public static void UpdatingEntity(this IEntity entity)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Core.Models.Entities
|
||||
/// <summary>
|
||||
/// Updates the entity when it is being saved for the first time.
|
||||
/// </summary>
|
||||
internal static void AddingEntity(this IEntity entity)
|
||||
public static void AddingEntity(this IEntity entity)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var canBeDirty = entity as ICanBeDirty;
|
||||
@@ -6,6 +6,8 @@
|
||||
/// </summary>
|
||||
public enum MembershipScenario
|
||||
{
|
||||
//TODO: This will become obsolete when we get asp.net identity members in place
|
||||
|
||||
/// <summary>
|
||||
/// The member is based on the native Umbraco members (IMember + Umbraco membership provider)
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// Provides a base class for <c>IPublishedProperty</c> implementations which converts and caches
|
||||
/// the value source to the actual value to use when rendering content.
|
||||
/// </summary>
|
||||
internal abstract class PublishedPropertyBase : IPublishedProperty
|
||||
public abstract class PublishedPropertyBase : IPublishedProperty
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedPropertyBase"/> class.
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// <para>Does not support variations: the ctor throws if the property type
|
||||
/// supports variations.</para>
|
||||
/// </remarks>
|
||||
internal class RawValueProperty : PublishedPropertyBase
|
||||
public class RawValueProperty : PublishedPropertyBase
|
||||
{
|
||||
private readonly object _sourceValue; //the value in the db
|
||||
private readonly Lazy<object> _objectValue;
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Represent the content app badge types
|
||||
/// </summary>
|
||||
[DataContract(Name = "contentAppBadgeType")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ContentAppBadgeType
|
||||
{
|
||||
[EnumMember(Value = "default")]
|
||||
Default = 0,
|
||||
|
||||
[EnumMember(Value = "warning")]
|
||||
Warning = 1,
|
||||
|
||||
[EnumMember(Value = "alert")]
|
||||
Alert = 2
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
/// Returns the currently configured membership scenario for members in umbraco
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
internal static MembershipScenario GetMembershipScenario(this IMemberService memberService)
|
||||
internal static MembershipScenario GetMembershipScenario(this IMemberTypeService memberTypeService)
|
||||
{
|
||||
if (_scenario.HasValue == false)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
return MembershipScenario.NativeUmbraco;
|
||||
}
|
||||
var memberType = Current.Services.MemberTypeService.Get(Constants.Conventions.MemberTypes.DefaultAlias);
|
||||
var memberType = memberTypeService.Get(Constants.Conventions.MemberTypes.DefaultAlias);
|
||||
return memberType != null
|
||||
? MembershipScenario.CustomProviderWithUmbracoLink
|
||||
: MembershipScenario.StandaloneCustomProvider;
|
||||
|
||||
@@ -4,19 +4,25 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace Umbraco.Core.Serialization
|
||||
{
|
||||
public class JsonNetSerializer : IJsonSerializer
|
||||
{
|
||||
private static readonly JsonConverter[] _defaultConverters = new JsonConverter[]
|
||||
{
|
||||
new StringEnumConverter()
|
||||
};
|
||||
|
||||
public string Serialize(object input)
|
||||
{
|
||||
return JsonConvert.SerializeObject(input);
|
||||
return JsonConvert.SerializeObject(input, _defaultConverters);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string input)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(input);
|
||||
return JsonConvert.DeserializeObject<T>(input, _defaultConverters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,11 +202,6 @@
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RichTextPreValueMigrator.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DropDownFlexiblePreValueMigrator.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\MergeDateAndDateTimePropertyEditor.cs" />
|
||||
<Compile Include="Models\ContentEditing\ContentApp.cs" />
|
||||
<Compile Include="Models\ContentEditing\ContentAppBadge.cs" />
|
||||
<Compile Include="Models\ContentEditing\ContentAppBadgeType.cs" />
|
||||
<Compile Include="Models\ContentEditing\IContentAppFactory.cs" />
|
||||
<Compile Include="Models\Entities\EntityExtensions.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorBase.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueDto.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\PropertyEditorsMigrationBase.cs" />
|
||||
@@ -223,6 +218,7 @@
|
||||
<Compile Include="Models\IContentTypeComposition.cs" />
|
||||
<Compile Include="Models\IDataType.cs" />
|
||||
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
|
||||
<Compile Include="Models\Identity\IdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\UserLoginInfoWrapper.cs" />
|
||||
<Compile Include="Models\IMediaType.cs" />
|
||||
<Compile Include="Models\IMember.cs" />
|
||||
@@ -230,7 +226,6 @@
|
||||
<Compile Include="Models\Language.cs" />
|
||||
<Compile Include="Models\Macro.cs" />
|
||||
<Compile Include="Models\MacroProperty.cs" />
|
||||
<Compile Include="Models\Membership\ContentPermissionSet.cs" />
|
||||
<Compile Include="Models\Membership\UserGroup.cs" />
|
||||
<Compile Include="Models\Membership\UserGroupExtensions.cs" />
|
||||
<Compile Include="Models\ObjectTypes.cs" />
|
||||
@@ -238,32 +233,17 @@
|
||||
<Compile Include="Models\PublicAccessEntry.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_8_0_0\FixLanguageIsoCodeLength.cs" />
|
||||
<Compile Include="Models\CultureImpact.cs" />
|
||||
<Compile Include="Models\Entities\IMediaEntitySlim.cs" />
|
||||
<Compile Include="Models\Entities\IMemberEntitySlim.cs" />
|
||||
<Compile Include="Models\Entities\MediaEntitySlim.cs" />
|
||||
<Compile Include="Models\Entities\MemberEntitySlim.cs" />
|
||||
<Compile Include="Models\PublishedContent\ILivePublishedModelFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\IndexedArrayItem.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedContent.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedContentTypeFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedElement.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedModelFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedProperty.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedValueFallback.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentType.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedElementModel.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedElementWrapped.cs" />
|
||||
<Compile Include="Models\PublishedContent\VariationContextAccessorExtensions.cs" />
|
||||
<Compile Include="Models\Template.cs" />
|
||||
<Compile Include="Models\TemplateOnDisk.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedContentType.cs" />
|
||||
<Compile Include="Models\PublishedContent\IPublishedPropertyType.cs" />
|
||||
<Compile Include="PropertyEditors\IIgnoreUserStartNodesConfig.cs" />
|
||||
<Compile Include="PropertyEditors\Validators\DelimitedValueValidator.cs" />
|
||||
<Compile Include="PropertyEditors\Validators\RegexValidator.cs" />
|
||||
<Compile Include="PropertyEditors\Validators\RequiredValidator.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="Models\PublishedContent\UrlMode.cs" />
|
||||
<Compile Include="Persistence\Dtos\PropertyTypeCommonDto.cs" />
|
||||
<Compile Include="Persistence\Factories\MacroFactory.cs" />
|
||||
<Compile Include="Persistence\Repositories\Implement\ContentTypeCommonRepository.cs" />
|
||||
@@ -412,12 +392,8 @@
|
||||
<Compile Include="Models\ContentTagsExtensions.cs" />
|
||||
<Compile Include="Models\ContentTypeBaseExtensions.cs" />
|
||||
<Compile Include="Models\DataTypeExtensions.cs" />
|
||||
<Compile Include="Models\Packaging\CompiledPackage.cs" />
|
||||
<Compile Include="Models\Packaging\CompiledPackageDocument.cs" />
|
||||
<Compile Include="Models\Packaging\CompiledPackageFile.cs" />
|
||||
<Compile Include="Models\PathValidationExtensions.cs" />
|
||||
<Compile Include="Models\PropertyTagsExtensions.cs" />
|
||||
<Compile Include="Models\PublishedContent\NoopPublishedValueFallback.cs" />
|
||||
<Compile Include="Models\SimpleContentType.cs" />
|
||||
<Compile Include="PackageActions\AllowDoctype.cs" />
|
||||
<Compile Include="PackageActions\PublishRootDocument.cs" />
|
||||
@@ -554,7 +530,6 @@
|
||||
<Compile Include="Models\EntityExtensions.cs" />
|
||||
<Compile Include="Models\GridValue.cs" />
|
||||
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\IdentityUser.cs" />
|
||||
<Compile Include="Models\Media.cs" />
|
||||
<Compile Include="Models\MediaExtensions.cs" />
|
||||
<Compile Include="Models\MediaType.cs" />
|
||||
@@ -567,7 +542,6 @@
|
||||
<Compile Include="Models\MemberType.cs" />
|
||||
<Compile Include="Models\MemberTypePropertyProfileAccess.cs" />
|
||||
<Compile Include="Models\Packaging\InstallationSummary.cs" />
|
||||
<Compile Include="Models\Packaging\PreInstallWarnings.cs" />
|
||||
<Compile Include="Models\PagedResultOfT.cs" />
|
||||
<Compile Include="Models\Property.cs" />
|
||||
<Compile Include="Models\PropertyCollection.cs" />
|
||||
@@ -575,18 +549,11 @@
|
||||
<Compile Include="Models\PropertyGroupCollection.cs" />
|
||||
<Compile Include="Models\PropertyType.cs" />
|
||||
<Compile Include="Models\PropertyTypeCollection.cs" />
|
||||
<Compile Include="Models\PublishedContent\NoopPublishedModelFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentTypeFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentExtensionsForModels.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentModel.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedModelAttribute.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedModelFactory.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentTypeConverter.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentWrapped.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedPropertyBase.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedPropertyType.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedSearchResult.cs" />
|
||||
<Compile Include="Models\PublishedContent\RawValueProperty.cs" />
|
||||
<Compile Include="Persistence\Dtos\AccessDto.cs" />
|
||||
<Compile Include="Persistence\Dtos\AccessRuleDto.cs" />
|
||||
<Compile Include="Persistence\Dtos\CacheInstructionDto.cs" />
|
||||
@@ -1095,6 +1062,8 @@
|
||||
<Name>Umbraco.Abstractions</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\ContentEditing\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -66,7 +66,7 @@ namespace Umbraco.Web.Editors.Binders
|
||||
/// <returns></returns>
|
||||
private IMember GetExisting(MemberSave model)
|
||||
{
|
||||
var scenario = _services.MemberService.GetMembershipScenario();
|
||||
var scenario = _services.MemberTypeService.GetMembershipScenario();
|
||||
var provider = Core.Security.MembershipProviderExtensions.GetMembersMembershipProvider();
|
||||
switch (scenario)
|
||||
{
|
||||
|
||||
@@ -2310,7 +2310,7 @@ namespace Umbraco.Web.Editors
|
||||
.Select(rule => rule.RuleValue).ToArray();
|
||||
|
||||
MemberDisplay[] members;
|
||||
switch (Services.MemberService.GetMembershipScenario())
|
||||
switch (Services.MemberTypeService.GetMembershipScenario())
|
||||
{
|
||||
case MembershipScenario.NativeUmbraco:
|
||||
members = usernames
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Umbraco.Web.Editors
|
||||
/// <value></value>
|
||||
protected MembershipScenario MembershipScenario
|
||||
{
|
||||
get { return Services.MemberService.GetMembershipScenario(); }
|
||||
get { return Services.MemberTypeService.GetMembershipScenario(); }
|
||||
}
|
||||
|
||||
public PagedResult<MemberBasic> GetPagedResults(
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Value = _localizedTextService.UmbracoDictionaryTranslate(member.ContentType.Name),
|
||||
View = Current.PropertyEditors[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
|
||||
},
|
||||
GetLoginProperty(_memberService, member, _localizedTextService),
|
||||
GetLoginProperty(_memberTypeService, member, _localizedTextService),
|
||||
new ContentPropertyDisplay
|
||||
{
|
||||
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}email",
|
||||
@@ -208,7 +208,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
/// <summary>
|
||||
/// Returns the login property display field
|
||||
/// </summary>
|
||||
/// <param name="memberService"></param>
|
||||
/// <param name="memberTypeService"></param>
|
||||
/// <param name="member"></param>
|
||||
/// <param name="display"></param>
|
||||
/// <param name="localizedText"></param>
|
||||
@@ -218,7 +218,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
/// the membership provider is a custom one, we cannot allow changing the username because MembershipProvider's do not actually natively
|
||||
/// allow that.
|
||||
/// </remarks>
|
||||
internal static ContentPropertyDisplay GetLoginProperty(IMemberService memberService, IMember member, ILocalizedTextService localizedText)
|
||||
internal static ContentPropertyDisplay GetLoginProperty(IMemberTypeService memberTypeService, IMember member, ILocalizedTextService localizedText)
|
||||
{
|
||||
var prop = new ContentPropertyDisplay
|
||||
{
|
||||
@@ -227,7 +227,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
Value = member.Username
|
||||
};
|
||||
|
||||
var scenario = memberService.GetMembershipScenario();
|
||||
var scenario = memberTypeService.GetMembershipScenario();
|
||||
|
||||
// only allow editing if this is a new member, or if the membership provider is the Umbraco one
|
||||
if (member.HasIdentity == false || scenario == MembershipScenario.NativeUmbraco)
|
||||
|
||||
Reference in New Issue
Block a user