Moved more abstractions of models
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an audited event.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
internal class AuditEntry : EntityBase, IAuditEntry
|
||||
{
|
||||
private int _performingUserId;
|
||||
private string _performingDetails;
|
||||
private string _performingIp;
|
||||
private int _affectedUserId;
|
||||
private string _affectedDetails;
|
||||
private string _eventType;
|
||||
private string _eventDetails;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int PerformingUserId
|
||||
{
|
||||
get => _performingUserId;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _performingUserId, nameof(PerformingUserId));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string PerformingDetails
|
||||
{
|
||||
get => _performingDetails;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _performingDetails, nameof(PerformingDetails));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string PerformingIp
|
||||
{
|
||||
get => _performingIp;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _performingIp, nameof(PerformingIp));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime EventDateUtc
|
||||
{
|
||||
get => CreateDate;
|
||||
set => CreateDate = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int AffectedUserId
|
||||
{
|
||||
get => _affectedUserId;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _affectedUserId, nameof(AffectedUserId));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string AffectedDetails
|
||||
{
|
||||
get => _affectedDetails;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _affectedDetails, nameof(AffectedDetails));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string EventType
|
||||
{
|
||||
get => _eventType;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _eventType, nameof(EventType));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string EventDetails
|
||||
{
|
||||
get => _eventDetails;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _eventDetails, nameof(EventDetails));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
public sealed class AuditItem : EntityBase, IAuditItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AuditItem"/> class.
|
||||
/// </summary>
|
||||
public AuditItem(int objectId, AuditType type, int userId, string entityType, string comment = null, string parameters = null)
|
||||
{
|
||||
DisableChangeTracking();
|
||||
|
||||
Id = objectId;
|
||||
Comment = comment;
|
||||
AuditType = type;
|
||||
UserId = userId;
|
||||
EntityType = entityType;
|
||||
Parameters = parameters;
|
||||
|
||||
EnableChangeTracking();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public AuditType AuditType { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string EntityType { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int UserId { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Comment { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Parameters { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a content app.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Content apps are editor extensions.</para>
|
||||
/// </remarks>
|
||||
[DataContract(Name = "app", Namespace = "")]
|
||||
public class ContentApp
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the content app.
|
||||
/// </summary>
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique alias of the content app.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Must be a valid javascript identifier, ie no spaces etc.</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the weight of the content app.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Content apps are ordered by weight, from left (lowest values) to right (highest values).</para>
|
||||
/// <para>Some built-in apps have special weights: listview is -666, content is -100 and infos is +100.</para>
|
||||
/// <para>The default weight is 0, meaning somewhere in-between content and infos, but weight could
|
||||
/// be used for ordering between user-level apps, or anything really.</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "weight")]
|
||||
public int Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the icon of the content app.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Must be a valid helveticons class name (see http://hlvticons.ch/).</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "icon")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for rendering the content app.
|
||||
/// </summary>
|
||||
[DataMember(Name = "view")]
|
||||
public string View { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The view model specific to this app
|
||||
/// </summary>
|
||||
[DataMember(Name = "viewModel")]
|
||||
public object ViewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the app is active.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Normally reserved for Angular to deal with but in some cases this can be set on the server side.</para>
|
||||
/// </remarks>
|
||||
[DataMember(Name = "active")]
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a content app factory.
|
||||
/// </summary>
|
||||
public interface IContentAppFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the content app for an object.
|
||||
/// </summary>
|
||||
/// <param name="source">The source object.</param>
|
||||
/// <returns>The content app for the object, or null.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The definition must determine, based on <paramref name="source"/>, whether
|
||||
/// the content app should be displayed or not, and return either a <see cref="ContentApp"/>
|
||||
/// instance, or null.</para>
|
||||
/// </remarks>
|
||||
ContentApp GetContentAppFor(object source, IEnumerable<IReadOnlyUserGroup> userGroups);
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an abstract file which provides basic functionality for a File with an Alias and Name
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public abstract class File : EntityBase, IFile
|
||||
{
|
||||
private string _path;
|
||||
private string _originalPath;
|
||||
|
||||
// initialize to string.Empty so that it is possible to save a new file,
|
||||
// should use the lazyContent ctor to set it to null when loading existing.
|
||||
// cannot simply use HasIdentity as some classes (eg Script) override it
|
||||
// in a weird way.
|
||||
private string _content;
|
||||
internal Func<File, string> GetFileContent { get; set; }
|
||||
|
||||
protected File(string path, Func<File, string> getFileContent = null)
|
||||
{
|
||||
_path = SanitizePath(path);
|
||||
_originalPath = _path;
|
||||
GetFileContent = getFileContent;
|
||||
_content = getFileContent != null ? null : string.Empty;
|
||||
}
|
||||
|
||||
private string _alias;
|
||||
private string _name;
|
||||
|
||||
private static string SanitizePath(string path)
|
||||
{
|
||||
return path
|
||||
.Replace('\\', System.IO.Path.DirectorySeparatorChar)
|
||||
.Replace('/', System.IO.Path.DirectorySeparatorChar);
|
||||
|
||||
//Don't strip the start - this was a bug fixed in 7.3, see ScriptRepositoryTests.PathTests
|
||||
//.TrimStart(System.IO.Path.DirectorySeparatorChar)
|
||||
//.TrimStart('/');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name of the File including extension
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public virtual string Name
|
||||
{
|
||||
get { return _name ?? (_name = System.IO.Path.GetFileName(Path)); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Alias of the File, which is the name without the extension
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public virtual string Alias
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_alias == null)
|
||||
{
|
||||
var name = System.IO.Path.GetFileName(Path);
|
||||
if (name == null) return string.Empty;
|
||||
var lastIndexOf = name.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase);
|
||||
_alias = name.Substring(0, lastIndexOf);
|
||||
}
|
||||
return _alias;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Path to the File from the root of the file's associated IFileSystem
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public virtual string Path
|
||||
{
|
||||
get { return _path; }
|
||||
set
|
||||
{
|
||||
//reset
|
||||
_alias = null;
|
||||
_name = null;
|
||||
|
||||
SetPropertyValueAndDetectChanges(SanitizePath(value), ref _path, nameof(Path));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original path of the file
|
||||
/// </summary>
|
||||
public string OriginalPath
|
||||
{
|
||||
get { return _originalPath; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called to re-set the OriginalPath to the Path
|
||||
/// </summary>
|
||||
public void ResetOriginalPath()
|
||||
{
|
||||
_originalPath = _path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Content of a File
|
||||
/// </summary>
|
||||
/// <remarks>Marked as DoNotClone, because it should be lazy-reloaded from disk.</remarks>
|
||||
[DataMember]
|
||||
[DoNotClone]
|
||||
public virtual string Content
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_content != null)
|
||||
return _content;
|
||||
|
||||
// else, must lazy-load, and ensure it's not null
|
||||
if (GetFileContent != null)
|
||||
_content = GetFileContent(this);
|
||||
return _content ?? (_content = string.Empty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetPropertyValueAndDetectChanges(
|
||||
value ?? string.Empty, // cannot set to null
|
||||
ref _content, nameof(Content));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file's virtual path (i.e. the file path relative to the root of the website)
|
||||
/// </summary>
|
||||
public string VirtualPath { get; set; }
|
||||
|
||||
// this exists so that class that manage name and alias differently, eg Template,
|
||||
// can implement their own cloning - (though really, not sure it's even needed)
|
||||
protected virtual void DeepCloneNameAndAlias(File clone)
|
||||
{
|
||||
// set fields that have a lazy value, by forcing evaluation of the lazy
|
||||
clone._name = Name;
|
||||
clone._alias = Alias;
|
||||
}
|
||||
|
||||
protected override void PerformDeepClone(object clone)
|
||||
{
|
||||
base.PerformDeepClone(clone);
|
||||
|
||||
var clonedFile = (File)clone;
|
||||
|
||||
// clear fields that were memberwise-cloned and that we don't want to clone
|
||||
clonedFile._content = null;
|
||||
|
||||
// ...
|
||||
DeepCloneNameAndAlias(clonedFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
internal sealed class Folder : EntityBase
|
||||
{
|
||||
public Folder(string folderPath)
|
||||
{
|
||||
Path = folderPath;
|
||||
}
|
||||
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the base contract for <see cref="IMember"/> and <see cref="IUser"/>
|
||||
/// </summary>
|
||||
public interface IMembershipUser : IEntity
|
||||
{
|
||||
object ProviderUserKey { get; set; }
|
||||
string Username { get; set; }
|
||||
string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the raw password value
|
||||
/// </summary>
|
||||
string RawPasswordValue { get; set; }
|
||||
|
||||
string PasswordQuestion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the raw password answer value
|
||||
/// </summary>
|
||||
string RawPasswordAnswerValue { get; set; }
|
||||
|
||||
string Comments { get; set; }
|
||||
bool IsApproved { get; set; }
|
||||
bool IsLockedOut { get; set; }
|
||||
DateTime LastLoginDate { get; set; }
|
||||
DateTime LastPasswordChangeDate { get; set; }
|
||||
DateTime LastLockoutDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of failed password attempts.
|
||||
/// This is the number of times the password was entered incorrectly upon login.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Alias: umbracoMemberFailedPasswordAttempts
|
||||
/// Part of the standard properties collection.
|
||||
/// </remarks>
|
||||
int FailedPasswordAttempts { get; set; }
|
||||
|
||||
//object ProfileId { get; set; }
|
||||
//IEnumerable<object> Groups { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the User Profile interface
|
||||
/// </summary>
|
||||
public interface IProfile
|
||||
{
|
||||
int Id { get; }
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
/// <summary>
|
||||
/// A readonly user group providing basic information
|
||||
/// </summary>
|
||||
public interface IReadOnlyUserGroup
|
||||
{
|
||||
string Name { get; }
|
||||
string Icon { get; }
|
||||
int Id { get; }
|
||||
int? StartContentId { get; }
|
||||
int? StartMediaId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The alias
|
||||
/// </summary>
|
||||
string Alias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The set of default permissions
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// By default each permission is simply a single char but we've made this an enumerable{string} to support a more flexible permissions structure in the future.
|
||||
/// </remarks>
|
||||
IEnumerable<string> Permissions { get; set; }
|
||||
|
||||
IEnumerable<string> AllowedSections { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the interface for a <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <remarks>Will be left internal until a proper Membership implementation is part of the roadmap</remarks>
|
||||
public interface IUser : IMembershipUser, IRememberBeingDirty, ICanBeDirty
|
||||
{
|
||||
UserState UserState { get; }
|
||||
|
||||
string Name { get; set; }
|
||||
int SessionTimeout { get; set; }
|
||||
int[] StartContentIds { get; set; }
|
||||
int[] StartMediaIds { get; set; }
|
||||
string Language { get; set; }
|
||||
|
||||
DateTime? EmailConfirmedDate { get; set; }
|
||||
DateTime? InvitedDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the groups that user is part of
|
||||
/// </summary>
|
||||
IEnumerable<IReadOnlyUserGroup> Groups { get; }
|
||||
|
||||
void RemoveGroup(string group);
|
||||
void ClearGroups();
|
||||
void AddGroup(IReadOnlyUserGroup group);
|
||||
|
||||
IEnumerable<string> AllowedSections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Exposes the basic profile data
|
||||
/// </summary>
|
||||
IProfile ProfileData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The security stamp used by ASP.Net identity
|
||||
/// </summary>
|
||||
string SecurityStamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Will hold the media file system relative path of the users custom avatar if they uploaded one
|
||||
/// </summary>
|
||||
string Avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A Json blob stored for recording tour data for a user
|
||||
/// </summary>
|
||||
string TourData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
public interface IUserGroup : IEntity, IRememberBeingDirty
|
||||
{
|
||||
string Alias { get; set; }
|
||||
|
||||
int? StartContentId { get; set; }
|
||||
int? StartMediaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The icon
|
||||
/// </summary>
|
||||
string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The set of default permissions
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// By default each permission is simply a single char but we've made this an enumerable{string} to support a more flexible permissions structure in the future.
|
||||
/// </remarks>
|
||||
IEnumerable<string> Permissions { get; set; }
|
||||
|
||||
IEnumerable<string> AllowedSections { get; }
|
||||
|
||||
void RemoveAllowedSection(string sectionAlias);
|
||||
|
||||
void AddAllowedSection(string sectionAlias);
|
||||
|
||||
void ClearAllowedSections();
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the number of users assigned to this group
|
||||
/// </summary>
|
||||
int UserCount { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Umbraco.Core.Models.Membership
|
||||
{
|
||||
/// <summary>
|
||||
/// The state of a user
|
||||
/// </summary>
|
||||
public enum UserState
|
||||
{
|
||||
All = -1,
|
||||
Active = 0,
|
||||
Disabled = 1,
|
||||
LockedOut = 2,
|
||||
Invited = 3,
|
||||
Inactive = 4
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a paged result for a model collection
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[DataContract(Name = "pagedCollection", Namespace = "")]
|
||||
public class PagedResult<T>
|
||||
{
|
||||
public PagedResult(long totalItems, long pageNumber, long pageSize)
|
||||
{
|
||||
TotalItems = totalItems;
|
||||
PageNumber = pageNumber;
|
||||
PageSize = pageSize;
|
||||
|
||||
if (pageSize > 0)
|
||||
{
|
||||
TotalPages = (long)Math.Ceiling(totalItems / (decimal)pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalPages = 1;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "pageNumber")]
|
||||
public long PageNumber { get; private set; }
|
||||
|
||||
[DataMember(Name = "pageSize")]
|
||||
public long PageSize { get; private set; }
|
||||
|
||||
[DataMember(Name = "totalPages")]
|
||||
public long TotalPages { get; private set; }
|
||||
|
||||
[DataMember(Name = "totalItems")]
|
||||
public long TotalItems { get; private set; }
|
||||
|
||||
[DataMember(Name = "items")]
|
||||
public IEnumerable<T> Items { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the skip size based on the paged parameters specified
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Returns 0 if the page number or page size is zero
|
||||
/// </remarks>
|
||||
public int GetSkipSize()
|
||||
{
|
||||
if (PageNumber > 0 && PageSize > 0)
|
||||
{
|
||||
return Convert.ToInt32((PageNumber - 1) * PageSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Partial View file
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class PartialView : File, IPartialView
|
||||
{
|
||||
public PartialView(PartialViewType viewType, string path)
|
||||
: this(viewType, path, null)
|
||||
{ }
|
||||
|
||||
internal PartialView(PartialViewType viewType, string path, Func<File, string> getFileContent)
|
||||
: base(path, getFileContent)
|
||||
{
|
||||
ViewType = viewType;
|
||||
}
|
||||
|
||||
public PartialViewType ViewType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class PublicAccessRule : EntityBase
|
||||
{
|
||||
private string _ruleValue;
|
||||
private string _ruleType;
|
||||
|
||||
public PublicAccessRule(Guid id, Guid accessEntryId)
|
||||
{
|
||||
AccessEntryId = accessEntryId;
|
||||
Key = id;
|
||||
Id = Key.GetHashCode();
|
||||
}
|
||||
|
||||
public PublicAccessRule()
|
||||
{
|
||||
}
|
||||
|
||||
public Guid AccessEntryId { get; internal set; }
|
||||
|
||||
public string RuleValue
|
||||
{
|
||||
get => _ruleValue;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _ruleValue, nameof(RuleValue));
|
||||
}
|
||||
|
||||
public string RuleType
|
||||
{
|
||||
get => _ruleType;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _ruleType, nameof(RuleType));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The states of a content item.
|
||||
/// </summary>
|
||||
public enum PublishedState
|
||||
{
|
||||
// versions management in repo:
|
||||
//
|
||||
// - published = the content is published
|
||||
// repo: saving draft values
|
||||
// update current version (draft) values
|
||||
//
|
||||
// - unpublished = the content is not published
|
||||
// repo: saving draft values
|
||||
// update current version (draft) values
|
||||
//
|
||||
// - publishing = the content is being published (transitory)
|
||||
// if currently published:
|
||||
// delete all draft values from current version, not current anymore
|
||||
// create new version with published+draft values
|
||||
//
|
||||
// - unpublishing = the content is being unpublished (transitory)
|
||||
// if currently published (just in case):
|
||||
// delete all draft values from current version, not current anymore
|
||||
// create new version with published+draft values (should be managed by service)
|
||||
|
||||
// when a content item is loaded, its state is one of those two:
|
||||
|
||||
/// <summary>
|
||||
/// The content item is published.
|
||||
/// </summary>
|
||||
Published,
|
||||
// also: handled over to repo to save draft values for a published content
|
||||
|
||||
/// <summary>
|
||||
/// The content item is not published.
|
||||
/// </summary>
|
||||
Unpublished,
|
||||
// also: handled over to repo to save draft values for an unpublished content
|
||||
|
||||
// when it is handled over to the repository, its state can also be one of those:
|
||||
|
||||
/// <summary>
|
||||
/// The version is being saved, in order to publish the content.
|
||||
/// </summary>
|
||||
/// <remarks>The <value>Publishing</value> state is transitional. Once the version
|
||||
/// is saved, its state changes to <value>Published</value>.</remarks>
|
||||
Publishing,
|
||||
|
||||
/// <summary>
|
||||
/// The version is being saved, in order to unpublish the content.
|
||||
/// </summary>
|
||||
/// <remarks>The <value>Unpublishing</value> state is transitional. Once the version
|
||||
/// is saved, its state changes to <value>Unpublished</value>.</remarks>
|
||||
Unpublishing
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using System;
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
// <summary>The Range class. Adapted from http://stackoverflow.com/questions/5343006/is-there-a-c-sharp-type-for-representing-an-integer-range</summary>
|
||||
/// <typeparam name="T">Generic parameter.</typeparam>
|
||||
public class Range<T> where T : IComparable<T>
|
||||
{
|
||||
/// <summary>Minimum value of the range.</summary>
|
||||
public T Minimum { get; set; }
|
||||
|
||||
/// <summary>Maximum value of the range.</summary>
|
||||
public T Maximum { get; set; }
|
||||
|
||||
/// <summary>Presents the Range in readable format.</summary>
|
||||
/// <returns>String representation of the Range</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0},{1}", this.Minimum, this.Maximum);
|
||||
}
|
||||
|
||||
/// <summary>Determines if the range is valid.</summary>
|
||||
/// <returns>True if range is valid, else false</returns>
|
||||
public bool IsValid()
|
||||
{
|
||||
return this.Minimum.CompareTo(this.Maximum) <= 0;
|
||||
}
|
||||
|
||||
/// <summary>Determines if the provided value is inside the range.</summary>
|
||||
/// <param name="value">The value to test</param>
|
||||
/// <returns>True if the value is inside Range, else false</returns>
|
||||
public bool ContainsValue(T value)
|
||||
{
|
||||
return (this.Minimum.CompareTo(value) <= 0) && (value.CompareTo(this.Maximum) <= 0);
|
||||
}
|
||||
|
||||
/// <summary>Determines if this Range is inside the bounds of another range.</summary>
|
||||
/// <param name="Range">The parent range to test on</param>
|
||||
/// <returns>True if range is inclusive, else false</returns>
|
||||
public bool IsInsideRange(Range<T> range)
|
||||
{
|
||||
return this.IsValid() && range.IsValid() && range.ContainsValue(this.Minimum) && range.ContainsValue(this.Maximum);
|
||||
}
|
||||
|
||||
/// <summary>Determines if another range is inside the bounds of this range.</summary>
|
||||
/// <param name="Range">The child range to test</param>
|
||||
/// <returns>True if range is inside, else false</returns>
|
||||
public bool ContainsRange(Range<T> range)
|
||||
{
|
||||
return this.IsValid() && range.IsValid() && this.ContainsValue(range.Minimum) && this.ContainsValue(range.Maximum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements <see cref="IRedirectUrl"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class RedirectUrl : EntityBase, IRedirectUrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RedirectUrl"/> class.
|
||||
/// </summary>
|
||||
public RedirectUrl()
|
||||
{
|
||||
CreateDateUtc = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private int _contentId;
|
||||
private Guid _contentKey;
|
||||
private DateTime _createDateUtc;
|
||||
private string _culture;
|
||||
private string _url;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int ContentId
|
||||
{
|
||||
get => _contentId;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _contentId, nameof(ContentId));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid ContentKey
|
||||
{
|
||||
get => _contentKey;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _contentKey, nameof(ContentKey));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime CreateDateUtc
|
||||
{
|
||||
get => _createDateUtc;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _createDateUtc, nameof(CreateDateUtc));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Culture
|
||||
{
|
||||
get => _culture;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _culture, nameof(Culture));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Url
|
||||
{
|
||||
get => _url;
|
||||
set => SetPropertyValueAndDetectChanges(value, ref _url, nameof(Url));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user